Python time localtime()方法
Python time localtime()方法
Python time localtime() 函數(shù)類(lèi)似gmtime(),作用是格式化時(shí)間戳為本地的時(shí)間。 如果sec參數(shù)未輸入,則以當(dāng)前時(shí)間為轉(zhuǎn)換標(biāo)準(zhǔn)。 DST (Daylight Savings Time) flag (-1, 0 or 1) 是否是夏令時(shí)。
語(yǔ)法
localtime()方法語(yǔ)法:
time.localtime([ sec ])
參數(shù)
- sec -- 轉(zhuǎn)換為time.struct_time類(lèi)型的對(duì)象的秒數(shù)。
返回值
該函數(shù)沒(méi)有任何返回值。
實(shí)例
以下實(shí)例展示了 localtime() 函數(shù)的使用方法:
實(shí)例
#!/usr/bin/python import time print "time.localtime() : %s" % time.localtime()
以上實(shí)例輸出結(jié)果為:
time.localtime() : time.struct_time(tm_year=2016, tm_mon=11, tm_mday=27, tm_hour=10, tm_min=26, tm_sec=5, tm_wday=6, tm_yday=332, tm_isdst=0)
相關(guān)文章
- Python 簡(jiǎn)介
- Python 日期和時(shí)間
- Python JSON
- Python3 注釋
- Python3 OS 文件/目錄方法
- Python3 XML 解析
- Python3 內(nèi)置函數(shù)
- Python exp() 函數(shù)
- Python File isatty() 方法
- Python os.fstatvfs() 方法
- Python os.makedev() 方法
- Python os.readlink() 方法
- Python os.rmdir() 方法
- Python encode()方法
- Python splitlines()方法
- Python List len()方法
- Python List append()方法
- Python 字典 Dictionary copy()方法
- Python time ctime()方法
- Python time strftime() 方法