如果有中文,并且是utf8的中文
[root@mysql1 pshell]# cat ex1.py
#!/usr/bin/env Python
print "高"
#print "hello world!"
print "hello again"
print "i like typing this."
print "this is fun."
print 'yay! printing.'
print "i'd much rather you 'not'."
File "ex1.py", line 3
SyntaxError: Non-ASCII character '\xe9' in file ex1.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
[root@mysql1 pshell]# cat ex1.py
#!/usr/bin/env Python
#-*-coding:utf-8-*-
print "高"
#print "hello world!"
print "hello again"
print "i like typing this."
print "this is fun."
print 'yay! printing.'
print "i'd much rather you 'not'."
print 'i "said" do not touch this.'
[root@mysql1 pshell]# python ex1.py
高
hello again
i like typing this.
this is fun.
yay! printing.
i'd much rather you 'not'.
i "said" do not touch this.
[root@mysql1 pshell]# cat ex1.py
#!/usr/bin/env Python
print "高"
#print "hello world!"
print "hello again"
print "i like typing this."
print "this is fun."
print 'yay! printing.'
print "i'd much rather you 'not'."
print 'i "said" do not touch this.'
File "ex1.py", line 3
SyntaxError: Non-ASCII character '\xe9' in file ex1.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
[root@mysql1 pshell]# cat ex1.py
#!/usr/bin/env Python
#-*-coding:utf-8-*-
print "高"
#print "hello world!"
print "hello again"
print "i like typing this."
print "this is fun."
print 'yay! printing.'
print "i'd much rather you 'not'."
print 'i "said" do not touch this.'
[root@mysql1 pshell]# python ex1.py
高
hello again
i like typing this.
this is fun.
yay! printing.
i'd much rather you 'not'.
i "said" do not touch this.
版权声明:本文为g13731463274原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。