python多进程&多线程
1.多进程定义
2.多线程
3.应用
3.1不使用多线程则顺序执行
1 import logging 2 from threading import Thread 3 from time import sleep, ctime 4 5 logging.basicConfig(level=logging.INFO) 6 7 8 def loop0(): 9 logging.info("start loop0 at " + ctime()) 10 sleep(4) 11 logging.info("end loop0 at " + ctime()) 12 13 14 def loop1(): 15 logging.info("start loop0 at " + ctime()) 16 sleep(2) 17 logging.info("end loop0 at " + ctime()) 18 19 20 def main(): 21 logging.info("start all at " + ctime()) 22 loop0() 23 loop1() 24 logging.info("end all at " + ctime()) 25 26 if __name__ == '__main__': 27 main()不使用多线程--顺序执行
标签:info,__,loop0,logging,ctime,python,进程,多线程 From: https://www.cnblogs.com/zwldyt/p/16972971.html