日志 - 执行时间

来源:互联网 发布:linux gzip 压缩 编辑:程序博客网 时间:2024/06/05 15:48
#!/usr/bin/env pythonfrom time import ctime, sleepdef tsfunc( func ):    def wrappedFunc():        print '[%s] %s() called' % ( ctime(), func.__name__ )        return func()    return wrappedFunc@tsfuncdef foo(): passfoo()sleep( 4 )for i in range( 2 ):    sleep( 1 )    foo()    -----------------------------root@snow-desktop:~/python# python test.py [Thu Apr 30 09:58:33 2015] foo() called[Thu Apr 30 09:58:38 2015] foo() called[Thu Apr 30 09:58:39 2015] foo() called

0 0
原创粉丝点击