环境:CentOS 7

Python版本:3.6

在写Python程序的时候遇到需要打开一个新的终端(terminal)或者说命令行窗口进行监视的情况,多方查询无果,终于在Stack Overflow上找到了。


import os
os.system("gnome-terminal -e 'ls'")

其中 'ls' 部分即为所需执行的内容。
这样打开的窗口会在执行完成后关闭,不希望关闭则可以写:


os.system("gnome-terminal -e 'bash -c \"ls; exec bash\"'")

--------------------- 

原文:https://blog.csdn.net/x_koozal/article/details/69703429 
 

GitHub 加速计划 / term / terminal
94.53 K
8.17 K
下载
The new Windows Terminal and the original Windows console host, all in the same place!
最近提交(Master分支:2 个月前 )
d04381ec "HighContrast" is not a possible requested theme. So `_UpdateBackgroundForMica()` would force the settings UI to be light or dark. To fix this, we just check if we're in high contrast mode and, if so, we don't bother setting the requested theme. 8 小时前
e83434ff Turns out that having the styles for the KeyChordText and ParsedCommandLineText be empty for high contrast mode caused the issue. Since we're already using theme resources for the colors, we automatically adjust properly to whatever the high contrast theme is (Thanks XAML!). Bonus points: - we didn't need the theme dictionaries anymore, so I just moved them to the ResourceDictionary directly - ParsedCommandLineTextBlockStyle isn't used. So I removed it altogether. Validated command palette with multiple high contrast themes. See PR thread for demo. Closes #17914 8 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐