No title

Error:

aise TypeError(‘unicode strings are not supported, please encode to bytes: {!r}’.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: ‘lift\n’

Solution

1
2
3
command = input('input command')  
ser.write(str.encode(command))
line = ser.readline()

使用 Str.encode()方法
或者{}.format