3.6版多线程
# -*- coding: utf-8 -*- import _thread from time import sleep, ctime def fun1(): sleep(2) print('aaaaaaaaaa') def fun2(): sleep(1) print('bbbbbbbbb') def main(): _thread.start_new_thread(fun1,()) _thread.start_new_thread(fun2,()) sleep(5) print('end') main() #------------带参数------------------------- # -*- coding: utf-8 -*- import _thread from time import sleep, ctime def fun1(page): sleep(2) print('aaaaaaaaaa=%i'%page) def fun2(page): sleep(1) print('bbbbbbbbb=%i'%page) def main(): page=1 _thread.start_new_thread(fun1,(page,)) page=2 _thread.start_new_thread(fun2,(page,)) sleep(5) print('end') main()