这篇教程Python time ctime()方法写得很实用,希望能帮到您。 描述Python time ctime() 函数把一个时间戳(按秒计算的浮点数)转化为time.asctime()的形式。如果参数未给或者为None的时候,将会默认time.time()为参数。它的作用相当于 asctime(localtime(secs))。 语法ctime()方法语法: time.ctime([ sec ]) 参数返回值该函数没有任何返回值。 实例以下实例展示了 ctime() 函数的使用方法: #!/usr/bin/pythonimport timeprint "time.ctime() : %s" % time.ctime() 以上实例输出结果为: time.ctime() : Tue Feb 17 10:00:18 2013 Python time clock()方法 Python time gmtime()方法 |