{'encoding': 'utf-8', 'confidence': 0.99, 'language': ''} Traceback (most recent call last): File "H:/PyCharmProject/ass/temp1.py", line 55, in <module> date=f.readline() UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 8: illegal multibyte sequence
想试试python转码。
网上随便下了一个txt小说。
python转码失败后,尝试用notepad++转utf8。却可以。
但转完的用 open()打开,还是出错,
不明白为什么 了?
f=open(r'C:\Users\ty\Downloads\zhenhuan.txt')
while 1:
date=f.readline()
if date:
date=date.strip()
print(date)
else:
break
相关分类