with open("a.html", 'w') as f:
f.write(html)
python在写入文件时报错
UnicodeEncodeError: 'gbk' codec can't encode character '\xa9' in position 1919: illegal multibyte sequence
解决方法
with open("a.html", 'w', encoding='utf-8') as f:
with open("a.html", 'w') as f:
f.write(html)
python在写入文件时报错
UnicodeEncodeError: 'gbk' codec can't encode character '\xa9' in position 1919: illegal multibyte sequence
解决方法
with open("a.html", 'w', encoding='utf-8') as f: