Python obtains the 13-bit unix timestamp, 13-bit Python
When developing a web program in python, you must call a third-party interface and sign the request. Unix timestamp is required.
In python, many methods are introduced online, and the timestamp is 10 bits. In java, the default value is 13 BITs (milliseconds in milliseconds ).
The following describes how to obtain the timestamp in python:
1. 10 timestamp acquisition method:
>>> Import time >>> t = time. time () >>>> print t1436428326.76 >>> print int (t) 1436428326 >>>
Forced conversion directly removes decimal places.
2. 13-bit timestamp acquisition method:
(1) by default, the python timestamp is a float output in seconds.
>>>>>> Import time >>> time. time () 1436428275.207596 >>>
Get the 13-bit timestamp by converting the second to the millisecond:
Import timemillis = int (round (time. time () * 1000) print millis
Round () is rounding.
(2)
Import timecurrent_milli_time = lambda: int (round (time. time () * 1000) Then: >>> current_milli_time () 1378761833768
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.