我正在尝试将假日名称传递给workalendar.europe库中的日期,但我没有结果
form workalendar.europe import France
cal._holidays.get(datetime.date(2015, 1, 1))
答案 0 :(得分:1)
使用workalendar.core.Calendar.holidays
返回(date, holiday)
对的列表:
>>> 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'