python中str类型字符串转为bytes类型,查看存储内容的编码 import chardet chardit1 = chardet.detect(b'Companyname') print (chardit1)