前言
此為以下問題的解決方法筆記:
'cp950' codec can't decode byte 0x8b in position 2607: illegal multibyte sequence
解法
簡單說就是 encoding 的問題,
在開啟對應檔案時加入「encoding=”utf-8″」即可以解決。
(注意檔案 open 的地方)
範例
原本你的程式可能長這樣 (注意 open 的地方)
with open(each_file, 'r') as fin:
jf = json.load(fin)
請改成這樣
with open(each_file, 'r', encoding="utf-8") as fin:
jf = json.load(fin)
Reference
https://oxygentw.net/blog/computer/python-file-utf8-encoding/
[…] 【Python】問題解決:’cp950′ codec can’t decode byte 0x8b in position 2607: … […]