用json解析字符串发现编码错误
records=[json.loads(line) for line in open(path)]
错误提示
UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xa1 in position 6: invalid start byte
解决办法:解析字符串的语句改为
records=[json.loads(unicode(line,'ISO-8859-1')) for line in open(path)]