UnicodeEncodeError: 'gbk' codec can't encode character '\ufffd' in position 2494: illegal multibyte sequence

写入文件报错UnicodeEncodeError: 'gbk' codec can't encode character '\ufffd' in position 2494: illegal multibyte sequence  解决方法

 

		with open('./abc.html', 'w', encoding='utf-8') as fp:
			fp.write(respone)

  

加入encoding='utf-8' 即可

 
 
 
 
 
 
 
 
 
 
posted @ 2023-09-15 15:46  modys  阅读(155)  评论(0编辑  收藏  举报