import chardet

a=b'\xe4\xbd\xa0\xe5\xa5\xbd\xef\xbc\x8c\xe4\xb8\x96\xe7\x95\x8c\xe3\x80\x82'
print(chardet.detect(a)) # {'encoding': 'utf-8', 'confidence': 0.99, 'language': ''}
print(a.decode('utf-8')) # 你好,世界。
这个模块多用于跨语言得到结果,或者爬虫

 

相关文章:

  • 2021-10-14
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-10-13
  • 2021-10-18
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2021-09-19
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-02-09
  • 2022-02-13
相关资源
相似解决方案