Judging that today is the day in recent years

import time
date=time.localtime()
year,month,day=date[:3]
day_month=[31,28,31,30,31,30,31,31,30,31,30,31]
if year%400==0 or (year%4==0 and year%100!=0):
    day_month[1]=29
    if month==1:
        print(day)
    else:
        print(sum(day_month[:month-1])+day)

 

Guess you like

Origin blog.csdn.net/qq_38452951/article/details/108940517