TypeError: Expected object of type bytes or bytearray, got: <class ‘str‘>

python中str类型字符串转为bytes类型,查看存储内容的编码

import chardet
chardit1 = chardet.detect(b'Companyname')  
print (chardit1)

你可能感兴趣的:(Python,python,unicode)