Use of the time function

import time

Acquisition of time:

1.time.time() This is a floating point number

2.time.ctime() This is the most concise and understandable mode

3.time.gmtime() This is the mode that the system handles

Time formatting:

        t=time.gmtime();

        time.strftime("%Y-%m-%d %H:%M:%S", t), function: change the time into a string;

time.strptime: Turning a string into a time is the complementary form of the time.strftime() function, which can turn a time string into a time that the system can handle

time using program timing:

        Measuring time function: perf_counter()

 

Generate time function: sleep()

 

Guess you like

Origin blog.csdn.net/weixin_62705892/article/details/123399279