記錄一段python程序的運行時間

import time

if __name__ == '__main__':
   start = time.perf_counter ()  # 起始時間
   
   我是函數( ̄▽ ̄)"

   end = time.perf_counter ()  # 結束時間
   print ('運行時間%.10fs' % (end - start))  # 輸出運行時間,精確到小數點後十位

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章