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. code complete part2

    基本数据类型: 1. 程序主体中仅能出现的数字就是0和1,除此之外,所有的数字都要用宏定义或者const类型,用清晰的变量名描述用途 2. 预防除零错误, assert(denominator!=0) ...

  2. Mac使用wireshark对移动设备抓包

    在系统偏好设置中,打开蓝牙共享网络,就能让移动设备通过连接蓝牙来访问网络,这个途径访问都会被wireshark所抓 然后捕获接口中可选 设置 筛选 为 http and (ip.src == 192. ...

  3. 多系统PE win UBUNTU OSX

    WIN8 PE来自黑果圈中著名的地平线大神- 内置wim安装工具.EFI修复工具 OSX PE来自 FireWolf OS X PE V7.0 UBUNTU 直接安装盘就能当PE用 需要一个FAT32 ...

  4. 跟我学Windows Azure 四 Cloud Service中的WebRole与WorkRole,及他们之间的通信

    Cloud Service 中WebRole就相当与我们的WebSite,而WorkRole相当与我们在服务器上写了个Windows Service,站在高可用的角度上来讲,Cloud Service ...

  5. 【耐克】【Air Max90 气垫跑鞋】

    [max90 36-44] [加毛冬款 36-44] [黑白百搭款 36-44] [air max90 高帮 冬款 耐看百搭 36-44] [air max90 高帮 40-44] [Air Max9 ...

  6. C# 下载搜狗词库

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); string[] userAgent = new string[]{& ...

  7. mysql.my.cnf

    [client]port = 3306socket = /tmp/mysql.sock [mysqld]port = 3306socket = /tmp/mysql.sock basedir = /u ...

  8. Eclipse for j2ee 无法调式问题

    首先要配置tomcat,window--preference--server--Installed Runtimes, add--选择tomcat--next--选择tomcat的安装目录(根目录)- ...

  9. 以Administrator权限运行VS时无法拖入文件

    解决办法 1.从任务管理器中关闭explorer进程(你会发现任务栏什么的都没有了) 2.从任务管理器启动explorer.exe(win8需要手动勾选"以管理员权限运行",win ...

  10. [PHP] - Apache + PHP 环境搭建

    Apache和PHP的版本分别为: httpd-2.4.9-win64-VC11.zip php-5.6.9-Win32-VC11-x64.zip 下载地址: php-5.6.9-Win32-VC11 ...