{'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
添加回答
舉報
0/150
提交
取消