我试图让Python运行这个命令,它在我的命令提示符下运行良好:
ccomps -x rel_graph.dot | gvpr -c "N[nNodes($G)<5]{delete(0,$)}" | dot | gvpack | sfdp -Goverlap=prism | gvmap -e | gvpr "BEGIN{int m,w,e = 0} N[fontcolor=='blue']{m += 1} N[fontcolor=='green']{e += 1} N[fontcolor=='red']{w += 1} END{print(m); print(w); print(e);}"
在Python中,我使用:
^{pr2}$…然后从temp读取/打印行。问题是Python没有将最后三个print语句(都是整数)打印到标准输出,或者至少我找不到它。gvpr程序的其余部分在Python中运行良好。在
谢谢!在
在做了更多的工作之后,我将开始引号改为double,所有内部参数都改为single,这似乎解决了这个问题。在
您可以将stdout\stderr发送到这样的文件-
然后从文件中读取stdout\stderr,例如:
^{pr2}$您可以检查命令的返回代码,以检查是否还需要像这样打印stderr-
相关问题 更多 >
编程相关推荐