Python3:使用open()打开文件时提示'gbk' codec can't decode byte的原因 2015-06-08 17598 Python utf-8 0 这是由于在Windows下Python使用open()函数打开文件时会默认使用gbk解码,即使文件本身存储为UTF-8格式。将:with open('temp.txt', 'r') as f:改为:with open('temp.txt','r',encoding='utf-8') as f:即指定以UTF-8解码方式打开此文件,这样就避免了解码错误。