很可能会报这个错:
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xbf in position 2: illegal multibyte sequence
报错的意思,是当内部编码转化成 gbk编码(默认)时出错,改为utf-8就好了:with open(path,“r”,encoding=“utf-8”) 。并用notepad打开文本文档修改编码格式为utf-8
def Solution(path):
with open(path,"r",encoding="utf-8") as f