ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

Python thread lambda run multiple functions

Python thread lambda run multiple functions
import datetime 
import uuid
import time
import numpy as np
import threadingdef get_uuid_time():return f"{uuid.uuid4().hex}_{datetime.datetime.now().strftime("%Y%m%d%H%M%S%f")}"def get_time_uuid():return f'{datetime.datetime.now().strftime("%Y%m%d%H%M%S%f")}_{uuid.uuid4().hex}'t1=threading.Thread(target=lambda:[(print(a),print(get_time_uuid()),print(get_uuid_time()),time.sleep(1))for a in range(1001)      
])t1.start()
t1.join()
print(f'Finished in {datetime.datetime.now()}')

 

 

image

 

 

 

 

 

image

 

返回列表