在python中用open(‘filename.txt’)读取指定txt时出现如题错误。 经分析1,指定编码方式即可。 txt = open('2018-05-03.txt', encoding= 'utf-8').read() Reference 云水禅心_心一, Python中读取txt文本出现“ ‘gbk’ codec can’t decode byte 0xbf in position 2: illegal multibyte sequence”的解决办法, 2017.08 ↩︎