摘要: subprocess.Popen用来创建子进程。1)Popen启动新的进程与父进程并行执行,默认父进程不等待新进程结束。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->defTestPopen():importsubprocessp=subprocess.Popen("dir",shell=True)foriinrange(250):print("otherthings")2)p.wait函数使得父进程 阅读全文
posted @ 2010-12-31 15:53 iTech 阅读(6851) 评论(2) 推荐(0)
摘要: python解析命令行参数 [推荐使用optionparser]一手动对sys.argv[1:]解析需要自己使用string比较或者regex来解析。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->importsysdefTestSys():forarginsys.argv[1:]:print(arg)二使用getopt模块来解析1. 处理所使用的函数叫getopt(),因为是直接使用import导入的getopt模块,所以要加上限定geto 阅读全文
posted @ 2010-12-31 11:28 iTech 阅读(5173) 评论(0) 推荐(0)