gpt4 book ai didi

python - workalendar.europe 图书馆 : how to find holidays

转载 作者:太空宇宙 更新时间:2023-11-04 05:41:14 24 4
gpt4 key购买 nike

我试图让假期名称通过 workalendar.europe 库中的日期,但我没有结果

form workalendar.europe import France
cal._holidays.get(datetime.date(2015, 1, 1))

最佳答案

使用返回 (date, holiday) 对列表的 workalendar.core.Calendar.holidays:

>>> import datetime
>>> from workalendar.europe import France
>>> cal = France()
>>> d = datetime.date(2015, 1, 1)
>>> holiday_map = dict(cal.holidays(d.year)) # list -> dict
>>> holiday_map.get(d, '?')
'New year'

关于python - workalendar.europe 图书馆 : how to find holidays,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33817380/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com