Python 闰年

import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s:%(name)s:%(levelname)s: %(message)s')


class Test(object):

    @staticmethod
    def is_leapYear(year):
        leap_year = False
        if (year % 4) == 0:
            if (year % 100) == 0:
                if (year % 400) == 0:
                    leap_year = True
            else:
                leap_year = True
        return leap_year

   
if __name__ == "__main__":
    test = Test()
    is_leap = test.is_leapYear(2001)
    logging.info("is_leap: %s" % is_leap)
posted @ 2021-05-24 15:11  Ccxing7  阅读(163)  评论(0编辑  收藏  举报