标签:
1.
1 #coding=utf-8
2 import threading
3 from time import ctime,sleep
4
5
6 def music(func):
7 for i in range(2):
8 print "I was listening to %s. %s" %(func,ctime())
9 sleep(1)
10
11 def move(func):
12 for i in range(2):
13 print "I was at the %s! %s" %(func,ctime())
14 sleep(5)
15
16 threads = []
17 t1 = threading.Thread(target=music,args=(u‘爱情买卖‘,))
18 threads.append(t1)
19 t2 = threading.Thread(target=move,args=(u‘阿凡达‘,))
20 threads.append(t2)
21
22 if __name__ == ‘__main__‘:
23 for t in threads:
24 t.setDaemon(True)
25 t.start()
26
27 print "all over %s" %ctime()
标签:
原文地址:http://www.cnblogs.com/IDomyself/p/4797062.html