Python List find方法报错 TypeError: 'str' does not support the buffer interface

来源:互联网 发布:java 线程池 状态 编辑:程序博客网 时间:2024/06/03 01:12


deviceList[1].find('device') 

List使用find方法时,报错误:

TypeError: 'str' does not support the buffer interface



In python 3, bytes strings and unicodestrings are now two different typesBytes strings are b"" enclosed strings

上述语句改为:deviceList[1].find(b'device') 就好了,加了个小b




0 0
原创粉丝点击