小编mar*_*hsu的帖子

如何使用python -c运行多行

我需要使用python -c远程运行一些代码,它在我使用时工作:

python -c "a=4;print a"
4
Run Code Online (Sandbox Code Playgroud)

要么

python -c "if True:print 'ye'"
Run Code Online (Sandbox Code Playgroud)

python -c "a=4;if a<5:print 'ye'"会产生错误:

File "<string>", line 1
    a=4;if a<5:print 'ye'
    SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能使它有效,有什么建议吗?

python

3
推荐指数
1
解决办法
123
查看次数

标签 统计

python ×1