多线程的例子:
import threadingimport timedef show(arg): time.sleep(1) print('thread' + str(arg))for i in range(10): t = threading.Thread(target=show, args=(i,)) t.start()print('main thread stop')
运行效果: