标签:syntaxerror
新建ex1.py
print "Hello World!" print "Hello Yang" 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.‘
执行命令:python ex1.py 结果如下:
[root@yang mystuff]# python ex1.py
hello world!
hello Again
I like typing this.
Yay! Printing.
I‘d much rather you ‘not‘.
I "said" do not touch this.
如果有如下类似错误信息:
File "ex/ex1.py",line 3
^
print "I like typing this.
SyntaxError:EOL while scanning string literal
SyntaxError:语法错误,这样一般来说为编码错误,即可以在脚本最上面加入
#-*-coding:utf-8-*- 就可以避免上述错误。
本文出自 “MGnuLinux” 博客,请务必保留此出处http://inspriion.blog.51cto.com/3283848/1652680
标签:syntaxerror
原文地址:http://inspriion.blog.51cto.com/3283848/1652680