Python计算程序运行时间的方法
作者:shichen2014 时间:2023-08-09 09:53:50
本文实例讲述了Python计算程序运行时间的方法。分享给大家供大家参考。具体实现方法如下:
def start_sleep():
time.sleep(3)
if __name__ == '__main__':
#The start time
start = time.clock()
#A program which will run for 3 seconds
start_sleep()
#The End time
end = time.clock()
print("The function run time is : %.03f seconds" %(end-start))
# End
希望本文所述对大家的Python程序设计有所帮助。
标签:Python,计算,时间
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
对python过滤器和lambda函数的用法详解
2022-04-23 06:37:47
PYTHON基础-时间日期处理小结
2023-04-23 02:02:59
Keras搭建M2Det目标检测平台示例
2023-11-10 10:49:01
![](https://img.aspxhome.com/file/2023/2/103192_0s.png)
使用pycharm运行flask应用程序的详细教程
2022-12-15 05:15:55
![](https://img.aspxhome.com/file/2023/1/95221_0s.png)
Python图像处理之图像金字塔的向上和向下取样
2021-12-19 03:56:06
![](https://img.aspxhome.com/file/2023/3/91953_0s.jpg)
页面加载对访问的影响
2009-10-30 18:54:00
![](https://img.aspxhome.com/file/UploadPic/200910/30/speed_taobaoued-30s.png)
Pyinstaller打包文件太大的解决方案
2022-01-20 22:19:24
![](https://img.aspxhome.com/file/2023/8/112388_0s.jpg)
Oracle数据库逻辑备份的SH文件
2010-07-27 13:26:00
简单好用的PHP分页类
2023-11-22 09:32:39
![](https://img.aspxhome.com/file/2023/6/111676_0s.jpg)
Django框架会话技术实例分析【Cookie与Session】
2021-06-24 03:41:53
详解Python实现进度条的4种方式
2023-07-05 13:31:16
![](https://img.aspxhome.com/file/2023/4/134814_0s.gif)
Python PyQt5中窗口数据传递的示例详解
2023-12-30 10:14:43
![](https://img.aspxhome.com/file/2023/9/114539_0s.gif)
新书:《精通CSS网页布局》
2009-01-08 11:57:00
![](https://img.aspxhome.com/file/UploadPic/20091/8/css-57s.gif)
JQuery中serialize()用法实例分析
2024-04-22 22:22:25
Python机器学习之决策树算法
2022-06-07 06:38:43
![](https://img.aspxhome.com/file/2023/9/103299_0s.png)
Python接口自动化之cookie、session应用详解
2023-02-02 11:10:35
![](https://img.aspxhome.com/file/2023/4/105764_0s.jpg)
用javascript实现select的美化
2007-05-11 16:50:00
打败 IE 的葵花宝典:CSS Bug Table
2010-08-03 12:30:00
![](https://img.aspxhome.com/file/UploadPic/20108/3/ie_bug_table-28s.jpg)
Python 通配符删除文件的实例
2022-04-24 03:00:22
Python 数据分析教程探索性数据分析
2022-06-25 17:38:38
![](https://img.aspxhome.com/file/2023/3/97423_0s.png)