Skip to main content
 首页 » 编程设计

python之如何扩展元组项作为参数 os 系统调用

2025年05月04日13shanyou

我想扩展我从 sys.argv 收集的元组项作为参数传递

像下面一样

os.system('git send-email ' + *args) 

但它在 *args 处给出错误

请您参考如下方法:

如何使用 subprocess.call :

subprocess.call(['git', 'send-email'] + list(args)) 

参见 Replacing Older Functions with the subprocess Module .