我正在使用位于https://github.com/catalyst/smokeping-mtr-alert/blob/master/smokeping-mtr-alert的脚本中的python代码在linux上实现MTR。
我所关心的代码行是
mtr_command = "mtr -n --report %s" % pipes.quote(args.hostname)我希望修改mtr的输出,以便使用-o选项提供我想要的粒度详细信息,特别是我想添加-o "LSRD NBWA JXIM V",但显然代码不能
mtr_command = "mtr -n --report %s -o "LSRD NBWA JXIM V" % pipes.quote(args.hostname)如何添加输出修饰符以获得所需的输出?
发布于 2018-02-28 02:21:45
mtr_command = 'mtr -n --report %s -o "LSRD NBWA JXIM V"'% pipes.quote(args.hostname)或
mtr_command = 'mtr -n --report {0} -o "LSRD NBWA JXIM V"'.format(pipes.quote(args.hostname))尝试在外部命令字符串上使用单引号,在内部使用双引号
https://stackoverflow.com/questions/49015389
复制相似问题