Python 中国节假日判断工作日和节假日 库
Python:使用chinesecalendar获取中国节假日判断工作日和节假日-CSDN博客
# 离线 pip install chinesecalendar https://pypi.org/project/chinesecalendar/ https://github.com/LKI/chinese-calendar/
# 在线 pip install china-calendar https://github.com/mouday/china-calendar https://pypi.org/project/china-calendar/
离线
import datetime from chinese_calendar import is_holiday, is_workday # 调班,上班 day1 = datetime.date(2024, 10, 12) # 休息 day2 = datetime.date(2024, 10, 13) print(is_workday(day1)) print(is_workday(day2)) # ============ D:\miniconda3\python.exe D:\gitlab\test_demo\121222222222222.py True False
在线
from china_calendar import is_workday, is_holiday # 调班,上班 print(is_workday('2024-10-12')) # 休息 print(is_workday('2024-10-13')) # ============ D:\miniconda3\python.exe D:\gitlab\test_demo\121222222222222.py True False