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
最佳答案
如注释中所示,您的错误是您在最后一个打印语句中忘记了撇号。
print 'I "said" do not touch this.'
玩得开心学习python。 LPTHW是学习它的好方法:)。
关于python - Powershell语法错误(python 2.7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15181264/