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. vsftp简单学习思考

    FTP的全称是File Transfer Protocol(文件传输协议),就是专门用来传输文件的协议.它工作在OSI模型的第七层,即是应用层,使用TCP传输而不是UDP这样FTP客户端和服务器建立连 ...

  2. 【C#】菜单功能,将剪贴板JSON内容或者xml内容直接粘贴为类

    VS 2015菜单功能,将剪贴板JSON内容或者xml内容直接粘贴为类

  3. FMDB的使用方法

    转自:http://blog.devtang.com/blog/2012/04/22/use-fmdb/ 前言 SQLite (http://www.sqlite.org/docs.html) 是一个 ...

  4. 基于ArcGIS API for Javascript的地图编辑工具

    最近工作上需要用ArcGIS API for Javascript来开发一个浏览器上使用的地图编辑工具,分享一下一些相关的开发经验. 我开发的地图编辑工具是根据ESRI提供的例子修改而来的,参考的例子 ...

  5. 编译CM14.1(sudmod71.1)过程记录

    编译CM14.1内存要求很高,至少8G以上,我的6G也可以搞定,交换空间分配大一点. 1.安装平台 建议安装Deepin 15.3桌面版系统,系统UI好看. 2.配置环境 (1)安装编译依赖库 sud ...

  6. iOS中获取当前时间,设定时间,并算出差值

    NSDate *date = [NSDate date];//获取当前时间 NSTimeZone *zone = [NSTimeZone systemTimeZone];//修改时区 NSIntege ...

  7. [Reproduced works]MongoDB Unauthorized Access Vulnerability

    mongodb未授权访问漏洞 catalogue 1. mongodb安装 2. 未授权访问漏洞 3. 漏洞修复及加固 4. 自动化检测点 1. mongodb安装 apt-get install m ...

  8. install hadoop on xubuntu

    0. install xubuntu we recommend to set username as "hadoop" after installation, set user & ...

  9. Pi 前2600位

    3.14 15926 53589 79323 84626 43383 27950 28841 97169 39937 51058 2097 4944 5 92307 81640 62862 0899 ...

  10. linux文件目录结构

    1./ 文件系统的入口,最高一级目录 2./bin 存放基础系统所需的命令 3./boot 包含Linux内核及系统引导程序所需要的文件 4./dev 设备文件存储目录(声卡.磁盘.分区..) 5./ ...