cliffgao的个人博客分享 http://blog.sciencenet.cn/u/cliffgao 兴趣:生物信息学、统计、概率

博文

python subprocess 模块

已有 2053 次阅读 2015-9-24 11:07 |个人分类:python|系统分类:科研笔记

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)





https://blog.sciencenet.cn/blog-468005-923029.html

上一篇:ubuntu 环境变量的设置
下一篇:contact Number Contact Order Contact Map
收藏 IP: 132.234.251.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-10-20 04:38

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部