import time import random import threading def hello(name): print("ThreadName: %s" % threading.current_thread().name) time.sleep(random.random() * 5) print("Hello, World: %s" %name) if __name__ == "__main__": t1 = threading.Thread(target=hello, args=('zhangsan',)) t2 = threading.Thread(target=hello, args=('lisi',)) t1.start() t2.start() t1.join() t2.join()