编程常见bug
UnicodeDecodeError: 'gbk' codec can't decode byte 0xb7 in position 16: illegal multibyte sequence
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xb7 in position 16: illegal multibyte sequence
出错代码:
with open(self
.teacher_path
, mode
="r") as fd_teacher
:
解决办法: 只需要在open函数参数中添加“encoding=‘utf-8’”,即:
with open(self
.teacher_path
, mode
="r",encoding
='utf-8') as fd_teacher
: