python - 如何在 python 脚本中运行终端命令?

标签 python macos terminal command

最好在 Mac 上,您需要导入哪些模块,或者只需要编写什么来运行一些简单的东西,例如:打开终端的 Python 脚本,并在 Mac 终端上使用 screencapture 命令每分钟捕获一次屏幕图像?

最佳答案

你可以试试:

import os
os.system('...your command...')

关于python - 如何在 python 脚本中运行终端命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49444204/

相关文章:

python - 使用 MySQLdb 执行 INSERT 时如何保护文本

python - 使用 python 的 Tkinter。为什么这里需要*args?

在 macOS Sierra 上使用 OpenSSL 的 python 请求

c# - 在 MacOS 上打开 Finder 窗口和访问硬件时遇到问题

css - OS X 搞乱了我的 css,如何修复

unix - tail 中的 -f 标志有什么作用?

python - 如何让 np.where 接受更多参数,以便它过滤 >、< 和 =;不仅仅是 > 和 <?

python - 在其他列表项中查找列表项的列表索引

python - python脚本的管道输出

c++ - 在 C++、Ubuntu 中使用 BMP 文件