||
subprocess 模块, 可以用来调用其他程序,如shell 等。 这个模块将来会替代之前老模块如os.system d等。
The subprocess module allows you to spawn new processes, connect to theirinput/output/error pipes, and obtain their return codes. This module intends toreplace several older modules and functions:
例如:
import os
cmd="ls "
os.system(cmd)
os.spawn*
或者
import subprocess
cmd="ls "
subprocess.call(cmd,shell=True)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-20 04:38
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社