34, python module learning -time module

! # / usr / bin / env Python 
#__author: HLC 
#date: 2019/6/7 

Import Time 

# Print (Help (Time)) # Time Help 
# print (time.time ()) # 1559884209.677806 # print a timestamp from 1970 to present seconds 
# the time.sleep (. 3) 
# Print (time.process_time ()) # alternative Clock 
# Print (time.perf_counter ()) # alternative Clock 
# Print (time.gmtime ()) # structured time; standard time; a time.struct_time (tm_year = 2019, tm_mon =. 6, tm_mday =. 7, tm_hour =. 5, tm_min = 24, = 54 is tm_sec, tm_wday =. 4, tm_yday = 158, the tm_isdst = 0) 
# Print (time. localtime ()) # local time; a time.struct_time (tm_year = 2019, tm_mon =. 6, tm_mday =. 7, 13 is tm_hour =, = 26 is tm_min, tm_sec = 22 is, tm_wday =. 4, tm_yday = 158, the tm_isdst = 0) 

# sturct_time time.localtime = () 
# Print (The time.strftime ( "the Y% -% m -% D% H:% m:% S", sturct_time)) # 2019--06--07 13:34:23

# Print (time.strptime ( "2019--06--07 13:34:23 ", "% Y -% m -% d% H:% M:% S")) # into a structured time ; a time.struct_time (tm_year = 2019, tm_mon =. 6, tm_mday =. 7, 13 is tm_hour =, = 34 is tm_min, tm_sec = 23 is, tm_wday =. 4, tm_yday = 158, the tm_isdst = -1) 

# A = the time.strptime ( " 13:34:23 2019--06--07 "," the Y% -% m -% D% H:% m:% S ") 
# Print (a.tm_year) taken in # 
# print (a. tm_hour) # take h 

# print (time.ctime (1)) # forward to a time stamp format; Thu Jan 1970 08:00:01. 1 
# Print (time.ctime (1,935,324,587)) # Wed On Apr 30 22:09 : 2031 47 

# Print (time.mktime (time.localtime ())) # 1,559,886,420.0; to convert the time stamp 


# Import datetime 
# Print (datetime.datetime.now ()) # 2019-06-07 13:48: 55.931961

  

Guess you like

Origin www.cnblogs.com/hlc-123/p/10988079.html