2013-03-03 78 views
0

的Python 2.7Powershell的语法错误(Python 2.7版)

当我尝试和执行一个Python脚本,我得到一个无效的语法错误。

powershell.exe 'c:\pythonscripts\ex1.py' 
File "<stdin>", line 1 
powershell.exe 'c:\pythonscripts\ex1.py' 
            ^

我知道它的工作原理,因为我只是用这个命令执行一个文件。 为的.py代码

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. 

的Python 2.7

+2

你在最后一个打印语句后缺少''',或者这是格式化你的问题的错误 – TerryA 2013-03-03 00:57:57

+0

谢谢:)这是错误的... ... Derp我大声笑。现在我只需要弄清楚如何暂停....再次感谢:) – user2127874 2013-03-03 01:03:24

回答

2

正如在评论中所示,你的错误是,你忘了你的最后print语句撇号。

print 'I "said" do not touch this.' 

玩得开心学习python。 LPTHW是学习它的好方法:)。

+0

是的它是:)... – user2127874 2013-03-03 01:07:04

+0

@ user2127874如果您发现答案有帮助,请您接受答案(点击打勾)以显示其他人这是最有用的答案?谢谢 :) – TerryA 2013-03-03 01:14:26