PyCharm运行报编码错误
运行报如下错误:
SyntaxError: Non-ASCII character '\xe8' in file /home/ubuntu/code/201803091253-text.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
解决方案:
在Python文件第一行,最前面加如下代码:
# -*- coding: utf-8 -*-
# 声明字符编码
# coding:utf-8
print('输出中文')