calendar模塊中,判斷是否閏年代碼 isleap
def isleap(year):
"""Return True for leap years, False for non-leap years."""
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
import calendar
orn = calendar.isleap(2010)
def isleap(year):
"""Return True for leap years, False for non-leap years."""
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
import calendar
orn = calendar.isleap(2010)