http://stackoverflow.com/questions/38714936/typeerror-str-does-not-support-the-buffer-interface-in-python

下面这样会报错:

b=b'{"m":1}'
import urllib.parse
urllib.parse.unquote(b)

修正方案:

b=b.decode()
urllib.parse.unquote(b)

即:对于字节流(byte)类型的数据,因此此类bug时,将它decode一下。

python3 TypeError: 'str' does not support the buffer interface in python的更多相关文章

  1. Python 3中套接字编程中遇到TypeError: 'str' does not support the buffer interface的解决办法

    转自:http://blog.csdn.net/chuanchuan608/article/details/17915959 目前正在学习python,使用的工具为python3.2.3.发现3x版本 ...

  2. python3使用套接字遇到TypeError: 'str' does not support the buffer interface如何解决

    这是我查看的博客 http://blog.csdn.net/chuanchuan608/article/details/17915959 直接引用里面的关键语句: When you use clien ...

  3. python编写telnet登陆出现TypeError:'str' does not support the buffer interface

    python3支持byte类型,python2不支持.在python3中,telnet客户端向远程服务器发送的str要转化成byte,从服务器传过来的byte要转换成str,但是在python2不清楚 ...

  4. python——TypeError: 'str' does not support the buffer interface

    import socket import sys port=51423 host="localhost" data=b"x"*10485760 #在字符串前加 ...

  5. Python的字符串修改报错:TypeError: 'str' object does not support item assignment

    Python中想修改字符串的最后一个字符,使用name[-1] = 'e'来实现,运行后报错. 报错内容是:TypeError: 'str' object does not support item ...

  6. Python学习笔记1 -- TypeError: 'str' object is not callable

    Traceback (most recent call last): File "myfirstpython.py", line 39, in <module> pri ...

  7. TypeError: 'str' object is not callable

    Python报错TypeError: 'str' object is not callable

  8. python3 TypeError: a bytes-like object is required, not 'str'

    在学习<Python web开发学习实录>时, 例11-1: # !/usr/bin/env python # coding=utf-8 import socket sock = sock ...

  9. python TypeError: 'str' object does not support item assignment”

    想替换string里的空格,遍历替换提示如题错误,查询得知string类型不可更改 import string s = "2013/2/12" b = s.replace('/', ...

随机推荐

  1. POJ 3422 Kaka's Matrix Travels

    Kaka's Matrix Travels Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9567   Accepted:  ...

  2. JS this指向

    正常模式 在正常模式下独立函数的的 this 指向 undefined 或 window. <script type="text/javascript"> functi ...

  3. C#知识点记录

    用于记录C#知识要点. 参考:CLR via C#.C#并发编程.MSDN.百度 记录方式:读每本书,先看一遍,然后第二遍的时候,写笔记. CLR:公共语言运行时(Common Language Ru ...

  4. UTF-8编码的空格(194 160)问题

    前台的字符串传递到后台进行处理,发现了一个较诡异的问题:字符串中的一个空格(ASCII:32)被UTF-8编码之后变成了一个诡异的字符(ASCII:194 和 160的组合)!但在后台其表象还是空格. ...

  5. pdo in 查询

    $ids1 = implode(",",$upload_ids);if(!empty($upload_ids)){ $ids_db= pdo_fetchall('select id ...

  6. 解决virtualbox装ghost xp装驱动时报portcls.sys蓝屏的问题

    原因:portcls.sys是声卡驱动文件,驱动与模拟的声卡型号不匹配. 解决办法:进入PE,把C:\sysprep\audio目录删除.进入系统后用驱动精灵装驱动.

  7. [git] warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF

    遇到这两个错误,是因为Git的换行符检查功能. core.safecrlf Git提供了一个换行符检查功能(core.safecrlf),可以在提交时检查文件是否混用了不同风格的换行符.这个功能的选项 ...

  8. SpringMVC学习记录3

    这次的主题 最近一直在学习SpringMVC..(这句话我已经至少写了3,4遍了....).这次的研究主要是RequestMappingHandlerAdapter中的各种ArgumentsResol ...

  9. iOS8新特性(1)-UIPopoverPresentationController使用

    从iOS 8开始,苹果提出新的 UIPopoverPresentationController代替UIPopoverController: 新的UIPopoverPresentationControl ...

  10. asp.net core 如何在Controller获取配置文件的值

    场景:我们会把一些配置信息,写在配置文件文件中,便于我们修改和配置.在之前的asp.net 中可以通过ConfigurationManger来获取web.config里面的配置.在.net core ...