【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: