Python time strptime()與time strftime()

time strftime()接收時間元組,返回表示時間的字符串。字符串

time strptime()把時間字符串,解析成一個時間元組。import

import time im

t = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))時間

print(t)字符

print(time.strptime(t,'%Y-%m-%d %H:%M:%S'))time

相關文章
相關標籤/搜索