使用python中的datetime
import datetimeoldtime=datetime.datetime.now()print oldtime;x=1while x<10000000: x=x+1newtime=datetime.datetime.now()print newtime;print u'相差:%s'%(newtime-oldtime)print u'相差:%s微秒'%(newtime-oldtime).microsecondsprint u'相差:%s秒'%(newtime-oldtime).seconds
結果如下:

總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對武林站長站的支持。如果你想了解更多相關內容請查看下面相關鏈接
新聞熱點
疑難解答