python 报错
TypeError: 'in ’ requires string as left operand, not int
原因:类型没对齐
username = ‘root’
tn.write(username + str(’\n’))
就会报错
应该改成
tn.write(username.encode(‘ascii’) + str(’\n’))
python3 中 文本字符串类型(unicode编码)被命名为str,字节字符串类型被命名为bytes,其中 str encode 得到 bytes, bytes decode 得到 str