This article mainly introduces Python's simple time formatting method, and analyzes Python's time formatting using the strftime function in combination with examples, for more information about how to format the time in Python, see the following example:
Walker often uses the current time and relative time to calculate the efficiency of program execution. it is easy to copy.
>>> Import time >>> startTime = time. time () >>> '%. 2fs '% (time. time ()-startTime) # relative time '24. 51s '>>> '{:. 2f} S '. format (time. time ()-startTime) # relative time '37. 55s '> time. strftime ('% Y-% m-% d % H: % M: % s', time. localtime (time. time () # format the current time '2017-01-05 10:34:06'
I hope this article will help you with Python programming.
For more information about the simple time formatting method of Python [strftime function], refer to PHP!