【发布时间】:2015-03-23 18:45:35
【问题描述】:
我想在 python 脚本中使用三个不同的引号,因为我想在不同的计算机上执行一个两行的 python 命令。例如:
import commands
command = "ssh someothercomputer 'python -c `import psutil; print psutil.cpu_percent()`'"
output = commands.getstatusoutput(command)[1]
但是,反引号不会被识别为引号。错误如下:
"Badly placed ()'s.\nArgument expected for the -c option\nusage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...\nTry `python -h' for more information."
我怎样才能让它工作?
【问题讨论】: