python 时间模块学习

来源:互联网 发布:电视盒子软件破解论坛 编辑:程序博客网 时间:2024/04/29 09:34
import timeprint time.time()       #返回纪元开始的秒数print time.ctime()      # 正常的打印时间print time.clock()      #clock()返回处理器时钟时间,它的返回值一般用于性能测试与基准测试。因此它们反映了程序的实际运行时间。from time import gmtime,strftimeprint strftime("%a, %d %b %Y %H:%M:%S ", gmtime())#Mon, 11 Jul 2016 14:25:11print strftime("%a, %d %b %Y %H:%M:%S ")'''def fucn():    time.sleep(5)    print "hello, world"fucn()#sleep函数用于将当前线程交出,要求它等待系统将其再次唤醒,如果写程序只有一个线程,这实际上就会阻塞进程,什么也不做'''
0 0
原创粉丝点击