mon*_*kut 27
您可以使用子进程直接重定向到文件.
import subprocess
with open('output.txt', 'w') as output_f:
p = subprocess.Popen('Text/to/execute with-arg',
stdout=output_f,
stderr=output_f)
Run Code Online (Sandbox Code Playgroud)
Ale*_*lli 10
最简单的是os.system("the.exe -a >thefile.txt"),但还有许多其他方法,例如subprocess标准库中的模块.
| 归档时间: |
|
| 查看次数: |
12126 次 |
| 最近记录: |