通过睡眠来排序:
from threading import Thread
import time
list_x = [1, 0.2, 0.5, 2, 0.9, 0.95]
list_y = []
def action(time_value):
time.sleep(time_value)
list_y.append(time_value)
thread_pool = []
for i in list_x:
t = Thread(target=action, args=(i,))
thread_pool.append(t)
for t in thread_pool:
t.start()
for t in thread_pool:
t.join()
print(list_y)