我想将Python 2制作的Python库转换为Python 3,here is the code。Python 2到3字节/字符串错误
我有152行中有一个错误的Py2版本,功能:
def write(self, data):
self._write_buffer += data
的错误是:
TypeError: Can't convert 'bytes' object to str implicitly
我发现,我已经给变量进行解码,所以我改变了功能:
def write(self, data):
self._write_buffer += data.decode('utf8')
它的工作原理,但我有异步库中的另一个错误,它说
(the Type) must be bytes or buffer, not str
那么,我该怎么办?
那么到底是什么问题呢? – 2010-11-05 08:59:14