Python time asctime()方法
生活随笔
收集整理的這篇文章主要介紹了
Python time asctime()方法
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
描述
Python time asctime() 函數(shù)接受時(shí)間元組并返回一個(gè)可讀的形式為"Tue Dec 11 18:07:14 2008"(2008年12月11日 周二18時(shí)07分14秒)的24個(gè)字符的字符串。
語法
asctime()方法語法:
time.asctime([t]))
參數(shù)
? t – 9個(gè)元素的元組或者通過函數(shù) gmtime() 或 localtime() 返回的時(shí)間值。
返回值
返回一個(gè)可讀的形式為"Tue Dec 11 18:07:14 2008"(2008年12月11日 周二18時(shí)07分14秒)的24個(gè)字符的字符串。
實(shí)例
以下實(shí)例展示了 asctime()函數(shù)的使用方法:
#!/usr/bin/python
import time
t = time.localtime()
print "time.asctime(t): %s " % time.asctime(t)
以上實(shí)例輸出結(jié)果為:
time.asctime(t): Tue Feb 17 09:42:58 2009
總結(jié)
以上是生活随笔為你收集整理的Python time asctime()方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 人工智能 信道估计 深度学习_DEMO演
- 下一篇: HERO引擎传奇遇到的问题以及解决办法