import threading import time from datetime import datetime as dt def say_hello(word): time.sleep(1) print(word) pool = [] now = dt.now() for x in range(10): t = threading.Thread(target=say_hello, args=(x,)) t.start() pool.append(t) for t in pool: t.join() end = dt.now() print('总时间:', (end - now).total_seconds())