摘要:
argparse命令行参数解析模块,原optparse已经停止开发,建议替换为argparse在python2.7后默认加入parserArgumentParser默认解析来源sys.argv,也可以提供显示参数进行解析。构造参数中,通常只需关心description和epilog。前者显示程序标题,后者在帮助信息的尾部显示详细的版权、使用描述等。程序代码:[root@typhoeus79 20131105]# more test_argparse.py #!/usr/bin/env python26#-*- coding:utf-8 -*-from argparse import Argum 阅读全文
摘要:
Process创建子进程执行指定的函数>>> from multiprocessing import Process,current_process>>> >>> def test(*args,**kwargs):... p = current_process()... print p.name,p.pid... print args... print kwargs... >>> >>> p = Process(target=test,args=(1,2),kwargs={"a":&q 阅读全文