python - Powershell语法错误(python 2.7)

标签 python powershell syntax-error

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/

相关文章:

c# - 从单独的线程更新 cmdlet 进度的最佳方法

php - PHP解析/语法错误;以及如何解决它们

javascript - 尽管有 ES6,是否存在 var 是最适合使用的关键字的情况?

python - 使用pandas对每两行输出的结果进行排序

python - 为 python setup.py 安装指定头文件位置

Powershell Active Directory 类似过滤器如何工作?

windows - 如何使用 Powershell 执行查找命令

mysql - 触发器编辑mysql中的其他表

python - 处理具有可怕日期时间数据的数据集

python - 如何在ZODB中设置缓存大小?