Python time time()方法

Python 教程 · 2019-02-03 13:12:04

描述

Python time time() 返回当前时间的时间戳(1970纪元后经过的浮点秒数)。

语法

time()方法语法:

time.time()

参数

  • NA。

返回值

返回当前时间的时间戳(1970纪元后经过的浮点秒数)。

实例

以下实例展示了 time() 函数的使用方法:

#!/usr/bin/python
import time

print "time.time(): %f " %  time.time()
print time.localtime( time.time() )
print time.asctime( time.localtime(time.time()) )

以上实例输出结果为:

time.time(): 1234892919.655932
(2009, 2, 17, 10, 48, 39, 1, 48, 0)
Tue Feb 17 10:48:39 2009

点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html

查看所有标签

Head First PHP & MySQL

Head First PHP & MySQL

Lynn Beighley、Michael Morrison / O'Reilly Media / 2008-12-29 / USD 44.99

If you're ready to create web pages more complex than those you can build with HTML and CSS, Head First PHP & MySQL is the ultimate learning guide to building dynamic, database-driven websites using P......一起来看看 《Head First PHP & MySQL》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码