This article describes how to use the time () method in Python. it is the basic knowledge of getting started with Python. if you need it, refer to the time () method return time, in UTC time, floating point numbers are expressed in seconds.
Note: Although it is always returned as a floating point number in time, not all systems provide a precision of over 1 second. Although this function normally returns a non-decreasing value, it can return a lower value than the previous call when the system clock has returned two calls.
Syntax
The syntax of the time () method is as follows:
Parameters
Return value
The time returned by this method, because the time in seconds represents a floating point (in UTC ).
Example
The following example shows how to use the time () method.
#! /Usr/bin/pythonimport timeprint "time. time (): % f "% time. time () print time. localtime (time. time () print time. asctime (time. localtime (time. time ()))
When we run the above program, it will produce the following results:
Time. time (): 1234892919.655932 (2014, 2, 17, 10, 28, 39, 1, 48, 0) Tue Feb 17 10:28:39 2014