2014-11-09 52 views

回答

4

你可以consult the docs for time,或者,如果你是懶惰的我一樣,你可能只是看看dir()爲對象,看看有什麼是有意義的:

>>> import time 
>>> x = time.localtime(time.time()) 
>>> dir(x) # output below formatted for readability and removing _-prefixed things 
['count', 'index', 'n_fields', 'n_sequence_fields', 'n_unnamed_fields', 'tm_hour', 
'tm_isdst', 'tm_mday', 'tm_min', 'tm_mon', 'tm_sec', 'tm_wday', 'tm_yday', 'tm_year'] 
>>> x.tm_hour 
23 

而且,事實上,在我的時間當我寫這個答案時,它確實是23:xy。