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

原文地址:https://www.cnblogs.com/Tommy-Yu/p/6122937.html