PHP
·
发表于 5年以前
·
阅读量:8396
>>> import calendar
>>> from datetime import date
>>> mydate = date.today()
>>> is_leap = calendar.isleap(mydate.year)
>>> ("{}是闰年" if is_leap else "{}不是闰年\n").format(mydate.year)
'2020是闰年'