从python运行可执行文件

问题描述 投票:0回答:1

我使用以下代码从python运行外部.exe文件:

import os

os.system('simulation.exe')

但是,当该文件运行时,用户应输入一个句子(image.mhd)才能完全运行。我如何从python输入该句子到此可执行文件?

python operating-system os.system
1个回答
0
投票

假设您要在命令行中输入“ image.mhd”,请尝试将以下行添加到您的Python代码中。

os.system('image.mhd')
© www.soinside.com 2019 - 2024. All rights reserved.