关于python的编码问题

代码如下:

#! /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 "你好!"


扫描二维码关注公众号,回复: 1762163 查看本文章

猜你喜欢

转载自blog.csdn.net/fristars2/article/details/74936938