python获取当月总天数与出勤天数

python获取当月总天数与出勤天数

import calendar
import datetime


def getMonthDayNum(year, month):
    monthRange = calendar.monthrange(year, month)[1]
    print(monthRange)
    return monthRange

def getBusinessDayNum(year, month):
    cal = calendar.Calendar()
    working_days = len([x for x in cal.itermonthdays2(year, month) if x[0] != 0 and x[1] < 5])
    return working_days

你可能感兴趣的:(python获取当月总天数与出勤天数)