1.在起始处添加 开始时间

2.程序运行

3.末尾处添加结束时间

4.结束时间 减去开始时间

 

 1 start1 = time.process_time()
 2 start2 = time.time()
 3 start3 = datetime.datetime.now()
 4 
 5 
 6 end1 = time.process_time()
 7 end2 = time.time()
 8 end3 = datetime.datetime.now()
 9 
10 print("程序运行时间1:",end1-start1)
11 print("程序运行时间2:",end2-start2)
12 print ("程序运行时间3:",(end3 - start3).seconds)

 

结果:

python 程序运行时间

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2021-10-29
  • 2021-12-15
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案