实现一个统计函数运行时间

1.datetime显示当前时间

import datetime


def Func(n):
    t = datetime.datetime.now()
    print t
    print "start **************"
    l=[]
    for i in range(1,10):
        l.append(i)
        time.sleep(1)
    e = datetime.datetime.now()
    print e
    print (e - t).seconds
Func(11)

猜你喜欢

转载自www.cnblogs.com/lanbing/p/9273154.html