1. 程式人生 > >Python文件讀取報錯 UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 9: illegal multibyte sequence

Python文件讀取報錯 UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 9: illegal multibyte sequence

http style png can odi utf posit python dede

源代碼:

fo = open("***.csv","r")

報錯:

技術分享圖片

解決方案:

fo = open("***.csv","r",encoding=UTF-8)

Python文件讀取報錯 UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 9: illegal multibyte sequence