第三课--time库使用

time库:

时间获取:time() , ctime() , gmtime()

时间格式化:strftime() , strptime()

程序计时:sleep() , perf_counter()

import time
print(time.time())
# 1611487365.9750214    1970.
print(time.ctime())
# Sun Jan 24 19:22:45 2021
print(time.gmtime())
# time.struct_time(tm_year=2021, tm_mon=1, tm_mday=24, tm_hour=11, tm_min=22, tm_sec=45, tm_wday=6, tm_yday=24, tm_isdst=0)

 

 

 

 

 2021-01-24

原文地址:https://www.cnblogs.com/2015-16/p/14321927.html