python3 TypeError: 'str' does not support the buffer interface in python

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一下。

 

posted @ 2016-12-01 17:48  tommy.yu  阅读(362)  评论(0编辑  收藏  举报