热线电话:13121318867

登录
2019-03-22 阅读量: 608
python的asctime函数有什么用

asctime(“time”): - 此函数接受由gmtime()生成的时间属性字符串,并返回表示时间24个字符串

# Python code to demonstrate the working of

# time() and gmtime()

# importing "time" module for time operations

import time

# using time() to display time since epoch

print ("Seconds elapsed since the epoch are : ",end="")

print (time.time())

# using gmtime() to return the time attribute structure

print ("Time calculated acc. to given seconds is : ")

print (time.gmtime())

输出:

Seconds elapsed since the epoch are : 1470121951.9536893
Time calculated acc. to given seconds is :
time.struct_time(tm_year=2016, tm_mon=8, tm_mday=2,
tm_hour=7, tm_min=12, tm_sec=31, tm_wday=1,
tm_yday=215, tm_isdst=0)
0.0000
2
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子