Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 443 Bytes

111.md

File metadata and controls

25 lines (19 loc) · 443 Bytes
@author jackzhenguo
@desc 
@date 2019/10/13

111 判断是否为闰年

import calendar
from datetime import date

mydate = date.today()
is_leap = calendar.isleap(mydate.year)
print_leap_str = "%s年是闰年" if is_leap else "%s年不是闰年\n"
print(print_leap_str % mydate.year)

打印结果:

2019年不是闰年
[上一个例子](110.md) [下一个例子](112.md)