运行 data = open('input.txt', 'r').read() 的时候一直报错,

Traceback (most recent call last):

File "C:/Users/wang/PycharmProjects/7-6/py2.py", line 2, in <module>

data = open('input.txt', 'r').read()

UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 0: illegal multibyte sequence

后来发现是 txt 文档的保存格式不对,

Python 读入文件报错

相关文章:

  • 2021-09-05
  • 2022-03-01
  • 2021-10-30
  • 2021-05-20
  • 2022-01-13
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2021-12-09
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-12-10
  • 2021-09-05
  • 2021-09-01
相关资源
相似解决方案