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. MatLab/HR

  2. JSBinding+Bridge.NET限制

    限制: 框架代码不可以访问逻辑代码.这是最基本的. 框架里的函数 f 带数组参数时,逻辑代码调用 f 的话,数组只能做为输入,也就是说,如果在框架函数 f 里修改了数组的内容,那么逻辑代码是无法取得新 ...

  3. delegate用法

    一般来说 delegate 可以申明一个delegate类型  比如 public delegate funa(object b) 然后使用的时候申明 funa 作为类型  new funa(回调函数 ...

  4. Python之路,day12-Python基础

    Mysql数据库操作 数据库介绍 什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库,每个数据库都有一个或多个不同的API用于创建,访问,管理,搜索和复制所保存的数据 ...

  5. C# 隐式类型转换

    implicit(C# 参考) implicit 关键字用于声明隐式的用户定义类型转换运算符.如果可以确保转换过程不会造成数据丢失,则可使用该关键字在用户定义类型和其他类型之间进行隐式转换. clas ...

  6. ASP.NET MVC图片上传

    工具:ssi-uploader $('#id').ssi_uploader({ url: 'path' }); public ActionResult path() { HttpPostedFileB ...

  7. mysql操作记录

    use mysql;select host,user,password from user; grant all privileges on *.* to root@'%' identified by ...

  8. struts2中web.xml的配置

    在web.xml</web-app>前添加的<filter></filter>和<filter-mapping></filter-mapping& ...

  9. time 模块

    import time导入时间模块print(time.strftime("%Y-%m-%d %X"))其中 time.strftime("Y-%m-%d")输 ...

  10. LVM在线扩容

    我虚拟机根分区已经使用了35%,现在需要对他进行在线扩容,扩容之后使用率降到30% [root@localhost ~]# dfFilesystem 1K-blocks Used Available ...