-
subprocess
The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several older modules and functions:
os.system os.spawn*
-
Overview
The recommended approach to invoking subprocesses is to use the
run()
function for all use cases it can handle.For more advanced use cases, the underlying
Popen
interface can be used directly.Run the command described by
args
, Wait for command to complete, then return aCompletedProcess
instance. -
有效描述
os.system
os.spawn
subprocess
这三个模块都可以完成一定程度的
shell
脚本,不过都是基于在linux
系统上运行python
而言,如果是在windows
系统上运行需要执行file.bs
文件的脚本就会出错。在
windows
上的方案还需要继续研究
Python如何运行shell脚本
最新推荐文章于 2024-07-20 21:13:19 发布