摘要: subprocess.Popen用来创建子进程。1)Popen启动新的进程与父进程并行执行,默认父进程不等待新进程结束。defTestPopen():importsubprocessp=subprocess.Popen("dir",shell=True)foriinrange(250):print(... 阅读全文
posted @ 2013-12-04 18:20 前行者2011 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #coding:utf-8import fileinputdef main(): lineno=0 for line in fileinput.input(r'G:\\subprocess.log'): lineno=fileinput.filelineno() re... 阅读全文
posted @ 2013-12-04 18:19 前行者2011 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 生成动态随机密码:import random,string'''length -- 指定密码的长度chars -- 指定密码有字母、数字、下划线及@、#组成times -- 指定一次生成的密码个数'''chars = string.lowercase+string.uppercase+''.jo... 阅读全文
posted @ 2013-12-04 17:23 前行者2011 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 在熟悉了Qt的QProcess以后,再回头来看python的subprocess总算不觉得像以前那么恐怖了。和QProcess一样,subprocess的目标是启动一个新的进程并与之进行通讯。subprocess.Popen这个模块主要就提供一个类Popen:class subprocess.Pop... 阅读全文
posted @ 2013-12-04 17:13 前行者2011 阅读(114) 评论(0) 推荐(0) 编辑