我刚从python 2切换到python 3,用python 2编写的python代码失败了。错误无法理解,我不想将python 2代码转换为兼容python 3的版本。如果我重写整个程序会更好。
但是,google中的资源很混乱,所以我找不到python 3 telnetlib模块的任何资源。有人知道这方面的资源吗?
我在执行中途转换的python代码时附加了错误消息:
File "E:\Python_Program\telnet.py", line 122, in <module>
tn.write(ftpUsername + "\n")
File "C:\Python32\lib\telnetlib.py", line 277, in write
if IAC in buffer:
TypeError: 'in <string>' requires string as left operand, not bytes发布于 2012-03-05 07:39:32
如果您的程序已经在python2.x中运行,那么我认为您真正需要的是查看文档中的文字大战。数据而不是Unicode Vs。8位部分,因为它解释了为什么要在问题中获得跟踪:
与2.x情况最大的区别是,在Python3.0中混合文本和数据的任何尝试都会引发TypeError
https://stackoverflow.com/questions/9562834
复制相似问题