这是我现有的(非功能性的)代码。你知道吗
def call_GM(sourcefile):
source = os.path.splitext(sourcefile)
outfile = '"' + source[0] + '_straightened' + source[1] + '"'
options = ('convert', '-auto-orient', sourcefile, outfile)
command = 'gm'
subprocess.call([command, options])
如果“options”的长度不总是固定的,如何正确地传递其内容?这是最简单的例子,但实际上我有类似的代码调用几个不同的命令。你知道吗
以平面列表或元组形式传递命令:
注意:将
options
修改为列表,因为list + tuple
是不允许的。你知道吗相关问题 更多 >
编程相关推荐