#What is the role of the time.time() function of the time library in python?
Function: Python time time() returns the timestamp of the current time (the number of floating point seconds elapsed since the 1970 epoch).
time() method syntax: time.time()
Parameters NA.
Return value Returns the timestamp of the current time (the number of floating point seconds elapsed since the 1970 epoch)
Example
The following example shows how to use the time() function:
#!/usr/bin/python import time print "time.time(): %f " % time.time() print time.localtime( time.time() ) print time.asctime( time.localtime(time.time()) )
The output result of the above example is:
time.time(): 1234892919.655932 (2009, 2, 17, 10, 48, 39, 1, 48, 0) Tue Feb 17 10:48:39 2009
Recommended tutorial: "Python Tutorial"
The above is the detailed content of What is the role of the time.time() function of the time library in python. For more information, please follow other related articles on the PHP Chinese website!