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. 【原创】Chrome最新版(53-55)再次爆出BUG!

    前言 今年十月份,我曾发布一篇文章<Chrome53 最新版惊现无厘头卡死 BUG!>,不过那个BUG在最新的 Chrome 54 中已经修正. 而今天即将发布的Chrome弱智BUG: ...

  2. 在ASP.NET Core中实现一个Token base的身份认证

    注:本文提到的代码示例下载地址> How to achieve a bearer token authentication and authorization in ASP.NET Core 在 ...

  3. 【C#】安装windows服务

    参考:http://blog.csdn.net ,http://blog.csdn.net/dyzcode 1.新建 visual studio insaller 项目2.添加 [文件系统]3.添加 ...

  4. Java读取xml配置文件

    package test.com; import java.io.FileInputStream; import javax.xml.parsers.DocumentBuilder;import ja ...

  5. RN中listView的每个item等高

    今天写ListView的每个Item的布局的时候发现,当文字太长时被截掉了不能完全显示,检查了很久发现没有设置固定高度都是可伸缩的为什么没有伸缩呢.看了很久才发现每个item是等高的,于是仔细检查才看 ...

  6. oschina代码仓库远程push,pull免密实操总结

    刚做项目,用到开源中国(oschina)的git仓库,一个多月一直在痛苦的反复输密码的过程中度过.中间配置过几次免密登录,但总是时而登的上去,时而不行,大多数情况不行.近几日项目做完了,正好有空把这个 ...

  7. MATLAB的三维散点图

    MATLAB中三维散点图函数为scatter3(x,y,z) 三维火柴图为stem3(x,y,z)

  8. java 引用传递及基本应用

  9. 加密算法中BASE64、MD5、SHA、HMAC等之间的区别

    http://blog.csdn.net/lplj717/article/details/51828692 根据项目需要了解了一下几种加密算法(参考其他博客),内容简要介绍BASE64.MD5.SHA ...

  10. centos6.5 更新yum源

    在使用centos过程中,自带的yum源包,不能满足的情况下,这个时候就可以考虑升级yum源了.国内用的比较多的是163镜像地址为http://mirrors.163.com/.help/centos ...