欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在Python操作時間和日期之a(chǎn)sctime()方法的使用

 更新時間:2015年05月22日 11:21:34   投稿:goldensun  
這篇文章主要介紹了在Python操作時間和日期之a(chǎn)sctime()方法的使用,是Python入門學(xué)習(xí)中的基礎(chǔ)知識,需要的朋友可以參考下

 asctime()方法將一個元組或struct_time表示的時間返回gmtime()或localtime(),以下列格式的24個字符的字符串:“Tue Feb 17 23:21:05 2015”。
語法

以下是asctime()方法的語法:

time.asctime([t]))

參數(shù)

  •     t -- 這是9個元素或struct_time元組表示所返回gmtime的()或localtime()函數(shù)的時間。

返回值

此方法返回以下形式的24個字符的字符串:“Tue Feb 17 23:21:05 2015”。
例子

下面的例子顯示了asctime()方法的使用。

#!/usr/bin/python
import time

t = time.localtime()
print "time.asctime(t): %s " % time.asctime(t)

當(dāng)我們運行上面的程序,它會產(chǎn)生以下結(jié)果:

time.asctime(t): Tue Feb 17 09:42:58 2014

相關(guān)文章

最新評論