time模块

time模块

import time

# 具体的时间
print(time.time())    #从1970.01.01.00:00:00开始计算,叫做计算机的元年

# 睡眠
print(1)
time.sleep(3)     # 睡眠
print(2)

# cpu级别的时间计算,一般用于程序耗时计算
start = time.perf_counter()
for i in range(10):
    print(i)
    time.sleep(0.01)
    print(time.perf_counter()-start)
posted @ 2019-07-16 17:07  PLPLPL  阅读(96)  评论(0编辑  收藏  举报
// 目录