【Python学习】Thread笔记(1)

Python学习笔记 - Thread(1)

标签(空格分隔): python



from threading import Thread

num = 2000
id_list = []

def do_work(id):
    id_list.append(id)

lat = 27.001
lng = 80.002
loc_list = []
threads = []
for i in range(num):
    t = Thread(target=do_work, args=(i,))
    threads.append(t)
    t.daemon = True
    t.start()

for x in threads:
    x.join()

print("Done!")
print id_list
原文地址:https://www.cnblogs.com/jennyhui/p/5710974.html