
subprocess.call("perl myCode.pl >results.txt", shell=True)要么
subprocess.call(["sh", "-c", "perl myCode.pl >results.txt"])
要么
with open('results.txt', 'wb', 0) as file: subprocess.call(["perl", "myCode.pl"], stdout=file)perl myCode.pl >results.txt。最后一个
perl通过自己
call执行重定向直接执行。这是更可靠的解决方案。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)