You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
368 B
21 lines
368 B
import multiprocessing as mp
|
|
import time
|
|
from threading import Thread
|
|
|
|
|
|
|
|
api_key_list = ["1","1","1","1","1","1","1","1",]
|
|
|
|
def job(a):
|
|
time.sleep(2)
|
|
return a
|
|
|
|
|
|
if __name__ == '__main__':
|
|
pool = mp.Pool()
|
|
a_list = []
|
|
for i in range(10):
|
|
res = pool.apply_async(job,(i,))
|
|
a_list.append(res)
|
|
for i in a_list:
|
|
print(i.get())
|