Discuss / Python / 运行例子会报错

运行例子会报错

Topic source

CentOS主机上交互环境下运行:'中文'.encode('utf-8')会提示:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

Win主机上一切正常,这是怎么回事?难道CentOS中的python不支持中文吗?

廖雪峰

#2 Created at ... [Delete] [Delete and Lock User]

用python3

谢谢,的确是版本的问题,CentOS带的是2.7


  • 1

Reply