subprocess

  模块方法: 

    call()

    check_call()

    check_output()

    以上三个方法用于创建一个子进程,父进程等待子进程结束。若shell = true, 则shell 参数以字符串形式给出,否则,则以序列的形式给出。

  Popen 对象:

    child = Popen((argsbufsize=-1executable=Nonestdin=Nonestdout=Nonestderr=Nonepreexec_fn=Noneclose_fds=True,shell=False,

           cwd=Noneenv=Noneuniversal_newlines=Falsestartupinfo=Nonecreationflags=0restore_signals=True,

           start_new_session=Falsepass_fds=()))

        Use communicate() rather than .stdin.write.stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers         filling up and blocking the child process.

    对象方法:

      child.poll()              # 检查子进程状态

      child.kill()               # 终止子进程

      child.send_signal()        # 向子进程发送信号

      child.terminate()        # 中止子进程

      child.wait()       #等待子进程终止

      child.communicate()   #和子进程交互

      

python3+ 模块学习 之 subprocess的更多相关文章

  1. python3+ 模块学习 之 re

    re 模块 参考:Python3 如何优雅地使用正则表达式(详解系列) Python3 正则表达式特殊符号及用法(详细列表)    (出处: 鱼C论坛) 正则表达式 常用元字符:. ^ $ * + ? ...

  2. 吴裕雄--天生自然python学习笔记:Python3 模块

    Python3 模块 在前面的几个章节中我们脚本上是用 python 解释器来编程,如果你从 Python 解释器退出再进入,那么你定义的所有的方法和变量就都消失了. 为此 Python 提供了一个办 ...

  3. python 常用模块 time random os模块 sys模块 json & pickle shelve模块 xml模块 configparser hashlib subprocess logging re正则

    python 常用模块 time random os模块 sys模块 json & pickle shelve模块 xml模块 configparser hashlib  subprocess ...

  4. python3.4学习笔记(十七) 网络爬虫使用Beautifulsoup4抓取内容

    python3.4学习笔记(十七) 网络爬虫使用Beautifulsoup4抓取内容 Beautiful Soup 是用Python写的一个HTML/XML的解析器,它可以很好的处理不规范标记并生成剖 ...

  5. Day5 - Python基础5 常用模块学习

    Python 之路 Day5 - 常用模块学习   本节大纲: 模块介绍 time &datetime模块 random os sys shutil json & picle shel ...

  6. (转)Python3 模块3之 Urllib之 urllib.parse、urllib.robotparser

    原文:https://blog.csdn.net/qq_36148847/article/details/79153738 https://blog.csdn.net/zly412934578/art ...

  7. python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法

    python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法window安装redis,下载Redis的压缩包https://git ...

  8. python3.4学习笔记(二十三) Python调用淘宝IP库获取IP归属地返回省市运营商实例代码

    python3.4学习笔记(二十三) Python调用淘宝IP库获取IP归属地返回省市运营商实例代码 淘宝IP地址库 http://ip.taobao.com/目前提供的服务包括:1. 根据用户提供的 ...

  9. python3.4学习笔记(十六) windows下面安装easy_install和pip教程

    python3.4学习笔记(十六) windows下面安装easy_install和pip教程 easy_install和pip都是用来下载安装Python一个公共资源库PyPI的相关资源包的 首先安 ...

随机推荐

  1. linux按键驱动之poll

    上一节应用程序的死循环里的读函数是一直在读的:在实际的应用场所里,有没有那么一种情况,偶尔有数据.偶尔没有数据,答案当然是有的.-->poll机制:Poll机制实现的是一定时间如果没有按键的话就 ...

  2. Android开发环境建立

    一.For windows 7(注:XP会有问题) 1.JDK-Java SE download: http://www.oracle.com/technetwork/java/javase/down ...

  3. 激!GSS系列

    #include <cstdio> ; ; inline int max(int, int); inline int getint(); inline void putint(int); ...

  4. [UI]抽屉菜单DrawerLayout分析(一)

    本文转载于:http://www.cnblogs.com/avenwu/archive/2014/04/16/3669367.html 侧拉菜单作为常见的导航交互控件,最开始在没有没有android官 ...

  5. 00 alv抬头等

    *&---------------------------------------------------------------------* *& Report ZHJ_TEST0 ...

  6. linux find命令

    Linux中find常见用法示例 ·find   path   -option   [   -print ]   [ -exec   -ok   command ]   {} \; find命令的参数 ...

  7. etcd第二集

    参考文章:https://github.com/coreos/etcd/blob/master/Documentation/v2/api.mdhttp://www.cnblogs.com/zhengr ...

  8. 利用SPM工具运行自己创建的小组件(使用common-model向后台接口请求数据)

    步骤如下: 1.安装依赖:spm install -e 2.编译:spm build (编译好的东西会放在trunk-dist里面) 3.发布:spm app -d (会出来一个export端口,一般 ...

  9. VS中的路径宏 vc++中OutDir、ProjectDir、SolutionDir各种路径

    原文链接:http://www.cnblogs.com/lidabo/archive/2012/05/29/2524170.html 说明 $(RemoteMachine) 设置为“调试”属性页上“远 ...

  10. 症状解决,原因不详的用非默认管理权限账户登录COM注册成功但找不到类型问题

    http://social.msdn.microsoft.com/Forums/en-US/11f01ceb-52a4-438f-b7ef-727ce7a3e191/atl-project-in-vs ...