datetime模块的date对象提供的timetuple方法可以返回一个 time.struct_time对象,这和time.localtime() 所返回的类型一致。
date.timetuple()
无
time.struct_time对象
>>> from datetime import date
>>> today = date.today()
>>> today.timetuple()
time.struct_time(tm_year=2022, tm_mon=6, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=2, tm_yday=152, tm_isdst=-1)
QQ交流群: 211426309