运行报如下错误:

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('输出中文')



 

相关文章:

  • 2021-08-09
  • 2022-12-23
  • 2021-12-31
  • 2021-09-28
  • 2022-01-17
  • 2021-11-10
  • 2022-01-16
  • 2021-05-20
猜你喜欢
  • 2021-06-28
  • 2021-07-23
  • 2022-01-28
  • 2022-12-23
  • 2021-10-11
  • 2021-10-15
  • 2021-06-24
相关资源
相似解决方案