import chardet s = b'xd7xaaxd5xbdOTT TVxb1xa6xbdxe0xc7xa3xcaxd6xd2xf8xbaxd3xa1xa4xc6xe6xd2xecxb9xfb' print chardet.detect(s) print s.decode('GB2312')
str = b'xe5xaex9dxe9xb8xa1xe5xb8x82'
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宝洁牵手银河・奇异果