【发布时间】:2013-08-28 00:24:02
【问题描述】:
我想运行命令:
print "hello"
print "world!"
来自 python 和来自 bash 的 -c 开关,如下所示:
python -c 'print "hello" \n print "world"'
但我不知道在-c 开关之后的字符串中正确的换行符应该是什么。
【问题讨论】:
标签: python bash command-line-interface
我想运行命令:
print "hello"
print "world!"
来自 python 和来自 bash 的 -c 开关,如下所示:
python -c 'print "hello" \n print "world"'
但我不知道在-c 开关之后的字符串中正确的换行符应该是什么。
【问题讨论】:
标签: python bash command-line-interface
怎么样:
python -c 'print "hello"; print "world"'
【讨论】:
python -c 'print "hello\nworld"'
【讨论】:
有些python语句不能写成一行,所以我推荐这个:
python -c '
print "hello"
print "world"
'
这样就可以出现for这样的语句了。
【讨论】: