python 获取秒级时间间隔
import datetime,time start_tm=datetime.datetime.now() time.sleep(2) end_tm=datetime.datetime.now() print((end_tm-start_tm).seconds)
输出
2
import datetime,time start_tm=datetime.datetime.now() time.sleep(2) end_tm=datetime.datetime.now() print((end_tm-start_tm).seconds)
输出
2