UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xa9’ in position 6870: illegal multibyte sequence
解决方案 open()方法添加 encoding=“utf-8”,示例如下
with open('test.html', 'w', encoding='utf-8') as f:
f.write(r.text)
2023-10-10 11:10:28
UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xa9’ in position 6870: illegal multibyte sequence
解决方案 open()方法添加 encoding=“utf-8”,示例如下
with open('test.html', 'w', encoding='utf-8') as f:
f.write(r.text)