2013-03-03 90 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