time.localtime
查看年月日时分秒
import time
timeTuple = time.localtime(time.time())
print("今年是",timeTuple[0],"年",timeTuple[1],"月",timeTuple[2],"号",
timeTuple[3],"点",timeTuple[4],"分",timeTuple[5],"秒","星期",timeTuple[6]+1,"是今年的第",timeTuple[7],"天")
time.strftime()
接收时间元组,返回 可读字符串 当地时间,格式由参数format决定
time.strftime(format[, t])
python中时间日期格式化符号:
%y 两位数的年份表示(00-99)
%Y 四位数的年份表示(000-9999)
%m 月份(01-12)
%d 月内中的一天(0-31)
%H 24小时制小时数(0-23)
%I 12小时制小时数(01-12)
%M 分钟数(00=59)
%S 秒(00-59)
%a 本地简化星期名称
%A 本地完整星期名称
%b 本地简化的月份名称
%B 本地完整的月份名称
%c 本地相应的日期表示和时间表示
%j 年内的一天(001-366&#x