subprocess模块——针对子进程
常用方法:
调用子进程call(),检查check_call(),返回子进程check_output()
threading模块——针对单个线程模块
常用对象:
1.threading.Thread对象——创建进程
对象方法:start(),run(),join()
2.threading.Lock对象
3.threading.Condition对象:
4.threading.Semaphore对象:
5.threading.Event对象:
multiprocessing模块——针对多个线程模块
常用对象:
1.multiprocessing.Process对象——创建进程
对象方法:start(),run(),join()
2.multiprocessing.Lock对象
3.multiprocessing.Condition对象:
4.multiprocessing.Semaphore对象:
5.multiprocessing.Event对象:
math模块和random模块——针对数字
math模块
常用方法:数学运算(幂指对开方取整正余弦)和数学函数
random模块
生成random(),挑选choice()/sample(),重排shuffle()
分布:高斯分布gauss(mu,sigma),指数分布expovariate(lambd)
itertools模块——循环
常用方法
1.循环:count()、cycle()、repeat()
2.函数:ifilterfalse()假、takewhile()真、dropwhile()跳过
3.组合:chain(A,B)连接、product(A,B)配对、permutations(A,2)排列、combinations(A,2)组合
4.切片islice(),组对izip()
sqlite3模块——数据库接口
常用语句同MySQL相同