- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlgy_thread.py
More file actions
Latest commit
24 lines (20 loc) · 505 Bytes
/
Copy pathlgy_thread.py
File metadata and controls
24 lines (20 loc) · 505 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# coding: utf-8
importthreading
importtime
defhello():
print("lgy")
time.sleep(1)
print(threading.current_thread().name)
if__name__=='__main__':
start=time.clock()
thread_list= []
foriinrange(1,3):
t=threading.Thread(target=hello)
thread_list.append(t)
t.start()
fortinthread_list:
print("开始了")
t.join()
end=time.clock()
print(threading.current_thread().name)
print('花掉时间'+str(end-start))