python-thread多线程

 1  #!/usr/bin/python
 2 import threading,time
 3 
 4 def Music():
 5     print "music is playing"
 6     time.sleep(3)
 7 
 8 def Movie():
 9     print "Movieis playing"
10     time.sleep(5)
11 
12 t1=threading.Thread(target=Movie)
13 t2=threading.Thread(target=Music)
14 
15 t1.setDaemon(True)
16 t1.start()
17 t2.setDaemon(True)
18 
19 t2.start()
20 t1.join()
21 t2.join()
22 
23 time.sleep(3)
24 print "all over!"
原文地址:https://www.cnblogs.com/chengyunshen/p/7195948.html