Skip to content

encode 跟 decode的問題 #7

Answered by jwlin
philosopher1121 asked this question in Q&A
Discussion options

You must be logged in to vote

這是 Excel 的問題。如果你用文字編輯器(如 notepad++)打開轉碼後的文件,可以看到正確顯示的中文字,編碼也是 utf-8
但是 Excel 開啟文件時,需要先辨認文件開頭的一段特殊字串,才能使用正確的編碼,詳情可 google "excel utf-8 bon 編碼"
解決方法:把 utf-8 改成 utf-8-sig 即可

with open('copy_csv.csv', 'w', encoding='utf-8-sig') as f:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@philosopher1121
Comment options

Answer selected by jwlin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants