#1
Python 输出 Unicode 字符到标准输出时遇到 UnicodeEncodeError
Python Unicode 字符编码
2016-06-22
源代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'中国'
报错:
Traceback (most recent call last):
File "test.py", line 4, in <module>
print u'中国'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)