关于python的编码问题

xiaoxiao2021-02-28  78

代码如下:

#! /usr/bin/python print "你好!"

运行后报错如下:

SyntaxError: Non-ASCII character '\xc4' in file 1.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

解决方法:

#! /usr/bin/python # -*- coding=UTF-8 -*- print "你好!"

转载请注明原文地址: https://www.6miu.com/read-44346.html

最新回复(0)