且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Python中使用参数运行应用程序?

更新时间:2021-09-18 22:26:57

args = ['test. exe']
subprocess.call(args, '-f')  //Error

应该是:

args = ['test.exe', '-f']
subprocess.call(args) 

命令行参数应该都在subprocess.call第一个参数的单个列表内。调用的第二个参数是bufsize,它应该是整数(因此,为什么会出现错误)

The command line argument should all be inside a single list for the first parameter of subprocess.call. The second argument to call is bufsize, which is supposed to be an integer (hence why you get the error you do)