考勤表年月日自动调整,哪种方法最简便?

考勤表年月日怎么自动调整

import datetime
import calendar

def generate_attendance_table(year, month):
    days_in_month = calendar.monthrange(year, month)[1]
    table = []
    for day in range(1, days_in_month + 1):
        date = datetime.date(year, month, day)
        weekday = date.weekday()
        table.append([date, date.strftime('%a')])  # 格式化为星期缩写
    return table

attendance_table = generate_attendance_table(2024, 10)
for row in attendance_table:
    print(row)

利唐i人事HR社区,发布者:ihreditor,转转请注明出处:https://www.ihr360.com/hrnews/20241210666.html

(0)
上一篇 1天前
下一篇 1天前

相关推荐