我正在阅读与python 3.5 json文件。在这个文件中它有像“í”的字符。我想以这种格式打印它。如何让下面的代码正确地打印字符?Python阅读字符串'í'并打印它
t = 'í'
print(t)
Traceback (most recent call last):
File "test.py", line 15, in <module>
print(t)
UnicodeEncodeError: 'ascii' codec can't encode character '\xed' in position 0: ordinal not in range(128)
[UnicodeEncodeError的可能重复: 'ASCII' 编解码器不能编码字符U位置20 '\ XA0':主要是有序不范围(128)](http://stackoverflow.com/questions/9942594/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-20) –
我不能再现这 - 它打印对于我来说足够了。你确定你在使用Python 3吗?在这种情况下,只有Python 2应该有这个错误。 –
这就是你使用Python 2运行时得到的错误 – abccd