【发布时间】:2019-10-14 02:41:49
【问题描述】:
我有以下代码:
for index, row in df_out.iterrows():
yield {
'CustomerName': str(row['CustomerName'])
}
我得到了 UnicodeEncodeError:
RuntimeError: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 10: ordinal not in range(128)
如何处理这部分以避免该错误?
str(row['CustomerName'])
【问题讨论】:
-
复制和粘贴代码会导致 \xe9 所以避免它。 Check This
-
@SantoshKarki 我没有复制/粘贴代码
-
然后查看上面的链接
-
@SantoshKarki 您链接的帖子是关于源代码中的非 ASCII 字符的。 OP 正在处理输入中的编码问题。
标签: python string unicode character-encoding