文件
f = open('D:\\python\\python sample.txt')f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 20: illegal multibyte sequence
然后网上查到用 encoding='UTF-8'解决了
f = open('D:\\python\\python sample.txt', encoding='UTF-8')
但是当f.seek(n,0)
f.readline() 又报错,请问这个怎么修改后可以读取相关内容
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte 查一下原始文件的编码格式 wp231957 发表于 2021-10-11 16:29
查一下原始文件的编码格式
文件编码格式是'UTF-8'
页:
[1]