先来判断下闰年
#判断闰年 a = calendar.isleap(2019) print(a) for i in range(2000,3000): print(i,calendar.isleap(i))
统计闰年试试
#统计闰年 x = calendar.leapdays(2000,3000) print(x)
通过python时间中的calendar我们可以判断出哪一年是闰年,同时统计出闰年的数目,相信对接下来的闰年小伙伴们已经了然于心了。
上一篇:equalsignorecase和equals有什么区别
下一篇:datetime如何在python3时间中执行循环