我理解错误与charector编码有关,但不确定如何修复它。
错误详情:
UnicodeEncodeError: 'charmap' codec can't encode character '\u263a' in position 124: character maps to <undefined>
这是发生的错误:
csv_writer.writerow(data_tmp_dict)
答案 0 :(得分:1)
尝试将其解码为UTF-8
# -*- coding: utf-8 -*-
data_tmp_dict = {'key': 'value'.encode("utf-8")}
# or
data_tmp_dict = {'key': 'value'.encode("ascii")}