【python】UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position

 

原因:

with open(file) as f:



需要改为:

with open(file, 'r',encoding="utf-8") as f:

 

posted @ 2021-09-09 16:51  太阳-向日葵  阅读(354)  评论(0编辑  收藏  举报