import time
time.time() #返回时间戳,表示当前时间距离1970年1月1日的秒数,带小数
如果要去掉小数的话用int转化一下即可,int(time.time())
time.localtime([secs]) #返回时间戳对应的时间数组(struct_time,不带参数则返回当前时间的
time.mktime(t) #将一个struct_time转化为时间戳,即time.localtime()的逆运算
time.sleep(10) #睡眠10秒
time.clock() #以浮点数计算的描述返回当前的CPU时间,用来计算不同程序的耗时,比time.time()更有用
#使用time.clock()计算程序耗时
import time
def procedure():
time.sleep(5)
time1 = time.clock()
procedure()
print(time.clock()-time1,"seconds process time!")