使用python中的datetime
1
2
3
4
5
6
7
8
9
10
11
|
import datetime oldtime = datetime.datetime.now() print oldtime; x = 1 while x< 10000000 : x = x + 1 newtime = datetime.datetime.now() print newtime; print u '相差:%s' % (newtime - oldtime) print u '相差:%s微秒' % (newtime - oldtime).microseconds print u '相差:%s秒' % (newtime - oldtime).seconds |
結果如下:
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對服務器之家的支持。如果你想了解更多相關內容請查看下面相關鏈接
原文鏈接:https://blog.csdn.net/cwcwcwcwcw26/article/details/41960381