Pythom time方法asctime()将表示gmtime()或localtime()返回的时间的tuple或struct_time转换为以下形式的24个字符的字符串:"Tue Feb 17 23:21:05 2009"。
time.asctime([t]))
t - 这是9个元素的元组或struct_time,表示由gmtime()或localtime()函数返回的时间。
此方法返回24个字符的字符串,格式如下:"Tue Feb 17 23:21:05 2009"。
链接:https://www.learnfk.comhttps://www.learnfk.com/python/time-asctime.html
来源:LearnFk无涯教程网
以下示例显示asctime()方法的用法。
#!/usr/bin/python import time t=time.localtime() print "time.asctime(t): %s " % time.asctime(t)
当无涯教程运行上面的程序时,它产生以下输出-
time.asctime(t): Tue Feb 17 09:42:58 2009
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)