python计算程序运行时间
2017-07-03 17:15
721 查看
import time def calculate_time(total_time): ''' total_time: total seconds ''' spend_seconds = total_time % 60 totalminutes = total_time // 60 spend_minutes = totalminutes % 60 spend_hours = totalminutes // 60 return spend_hours, spend_minutes, spend_seconds def main(): start_time = time.time() ‘’‘ 相关程序 ’‘’ end_time = time.time() total_time = end_time - start_time spend_hours, spend_minutes, spend_seconds = calculate_time(total_time) print 'Total running time of the example: %.2f seconds ( %i hours %i minutes %.2f seconds )' \ % (total_time, spend_hours, spend_minutes, spend_seconds) main()
相关文章推荐
- python-time模块计算程序运行的时间
- Python基础-计算程序运行时间
- 计算Python的代码块或程序的运行时间
- 计算Python的代码块或程序的运行时间
- C、Java及Python中计算程序运行时间
- Python 计算程序运行时间
- python用time函数计算程序运行时间
- 三种计算Python的代码块或程序的运行时间的方法比较
- python计算程序开始到程序结束的运行时间和程序运行的CPU时间
- python计算程序开始到程序结束的运行时间和程序运行的CPU时间
- Python计算程序运行时间
- Python 计算程序运行时间
- Python计算程序运行时间
- 通过计算python执行时间,来提升程序的运行效率
- python程序运行时间-期权组合计算
- python计算程序开始到程序结束的运行时间和程序运行的CPU时间
- Python计算程序运行时间的方法
- opencv for python (7) 计算中值滤波函数程序的运行时间,及简要解释中值滤波函数
- Python计算程序运行时间
- Python计算程序运行时间