1
prules=subprocess.check_output("perl ruleFinder.pl "+datasetfile+" "+myrulepath, shell=True)##call a different program to produce a list of rules that predict contact
我正在使用此代碼調用另一個程序,並從該程序中獲取數據。使用這個過程需要大約一分鐘的時間。有更快的更有效的功能我可以使用嗎?subprocess.check_output更快的方式
需要多長時間從shell(或命令提示符)運行相同的命令?你確定subprocess.check_output()是否是瓶頸? – 2013-04-30 15:15:46
真的需要使用'shell = True'嗎?它帶來了很多麻煩,特別是如果你的文件名中有空格。你試過'subprocess.check_output(['perl','ruleFinder.pl',datasetfile,myrulepath])' – glglgl 2013-04-30 15:28:52
我同意'shell = True'。傳遞參數列表更清晰。 – 2013-04-30 15:30:19