1.open文件设置encoding

file = open(filename, 'r', encoding='UTF-8')

2.用encode方法

str = str.encode()

参考:https://www.fujieace.com/python/str-bytes.html

相关文章:

  • 2022-01-07
  • 2022-01-10
  • 2022-12-23
  • 2021-07-21
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2022-02-01
  • 2021-07-13
  • 2022-01-14
相关资源
相似解决方案