想看程序运行时间,而python中又没有类似matlab的tic,toc函数,只能自己写程序实现该功能啦~
主要是想就是,程序开始记下当前时间,程序结束记下当前时间,作差即为程序运行时间
from datetime import datetime
tic = datetime.now()
...
<程序段>
...
toc = datetime.now()
print('Elapsed time: %f seconds' % (toc-tic).total_seconds())
想看程序运行时间,而python中又没有类似matlab的tic,toc函数,只能自己写程序实现该功能啦~
主要是想就是,程序开始记下当前时间,程序结束记下当前时间,作差即为程序运行时间
from datetime import datetime
tic = datetime.now()
...
<程序段>
...
toc = datetime.now()
print('Elapsed time: %f seconds' % (toc-tic).total_seconds())