从git上clone老师的代码下来学习,一运行报了这个编码的错误,猜想原因可能是这个utf-8在搞鬼,因为老师是mac环境而我是windows。于是在读写文件的open函数里加上utf-8.
with open(‘model.json’, ‘r’, encoding=‘utf-8’) as file:
with open(file_path, ‘r’, encoding=‘utf-8’) as file:
修改之后就可以运行了
从git上clone老师的代码下来学习,一运行报了这个编码的错误,猜想原因可能是这个utf-8在搞鬼,因为老师是mac环境而我是windows。于是在读写文件的open函数里加上utf-8.
with open(‘model.json’, ‘r’, encoding=‘utf-8’) as file:
with open(file_path, ‘r’, encoding=‘utf-8’) as file:
修改之后就可以运行了