gpt4 book ai didi

python - 在不同的控制台窗口中启动进程

转载 作者:行者123 更新时间:2023-12-01 06:11:54 24 4
gpt4 key购买 nike

如何在 Linux 中使用 Python 启动一个进程在不同的控制台窗口中运行,与 Windows 中的类似(使用 start):

import os

os.system('start dir c:\*.* /s')

最佳答案

xterm -e 应该可以帮到你。

-e program [ arguments ... ]

This option specifies the program (and its command line arguments) to berun in the xterm window. It also setsthe window title and icon name to bethe basename of the program beingexecuted if neither -T nor -n aregiven on the command line. This mustbe the last option on the commandline.

例如

import os

os.system("xterm -e 'your command'")

关于python - 在不同的控制台窗口中启动进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5476239/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com