【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:
原文地址:https://www.cnblogs.com/taiyangfeng/p/15247758.html