Python \xd7\xaa\xd5\xbdOTT TV\xb1\xa6\xbd\xe0 编码

 
import chardet

s = b'\xd7\xaa\xd5\xbdOTT TV\xb1\xa6\xbd\xe0\xc7\xa3\xca\xd6\xd2\xf8\xba\xd3\xa1\xa4\xc6\xe6\xd2\xec\xb9\xfb'
print chardet.detect(s)
print s.decode('GB2312')
str = b'\xe5\xae\x9d\xe9\xb8\xa1\xe5\xb8\x82'
print(str.decode('utf-8'))
#result = chardet.detect(s) #if result: # encode = result['encoding'] # if encode: # print a.decode(encode)  输出 # {'confidence': 0.99, 'language': 'Chinese', 'encoding': 'GB2312'} # 转战OTT TV宝洁牵手银河・奇异果

 

posted on 2017-11-16 17:09  shaomine  阅读(808)  评论(0编辑  收藏  举报