import multiprocessing
data_list = []
def task(arg):
data_list.append(arg)
print(data_list)
def run():
for i in range(10):
p = multiprocessing.Process(target=task, args=(i,))
p.start()
if __name__ == '__main__':
run()
'''
打印结果:
[0]
[2]
[3]
[1]
[4]
[6]
[5]
[8]
[7]
[9]
'''