(模塊名)time.time()(方法名)
time.strftime('%Y_%m_%d %X') # 2019_08_16 10:26:36
time.localtime() # 當地時間(中國) time.gmtime() # 標準時間 # time.struct_time(tm_year=2019, tm_mon=8, tm_mday=16, tm_hour=19, tm_min=42, tm_sec=44, tm_wday=4, tm_yday=228, tm_isdst=0) # time.struct_time(tm_year=2019, tm_mon=8, tm_mday=16, tm_hour=11, tm_min=42, tm_sec=44, tm_wday=4, tm_yday=228, tm_isdst=0)
print(time.strftime('%Y-%m-%d %X', time.localtime())) # 2019-08-16 19:42:44
print(time.strptime('2019-08-16 10:30:44', '%Y-%m-%d %X')) # time.struct_time(tm_year=2019, tm_mon=8, tm_mday=16, tm_hour=10, tm_min=30, tm_sec=44, tm_wday=4, tm_yday=228, tm_isdst=-1)
print(time.mktime(time.localtime())) # 1565955764.0
print(time.localtime(time.time())) # time.struct_time(tm_year=2019, tm_mon=8, tm_mday=16, tm_hour=19, tm_min=42, tm_sec=44, tm_wday=4, tm_yday=228, tm_isdst=0)
time.time()python
time.sleep()code