Python读取文件时出现UnicodeDecodeError
运行下面code时
with open('style.css','r',encoding='utf-8') as f:
for line in f:
print(line)
出现错误
UnicodeDecodeError: 'gbk' codec can't decode byte 0x9d in position 1947: illegal multibyte sequence
将open代码改为
with open('style.css','r',encoding='utf-8') as f:
for line in f:
print(line)