python读文件经常会出现 UnicodeDecodeError: 'gbk' codec can't decode byte 0xbd in position 764: illegal multibyte sequence
解决方法:
以"rb",方式读再以一定的方式解码,如"UTF-8","UTF-16", "gbk"
with open(log_path, 'rb') as fd:
lines = [l.decode('utf8', 'ignore') for l in fd.readlines()]