We use Python 3.6

go back Level: Intermediate (img: IM / score: 3) level Bite 97. BeautifulSoup II - scrape US bank holidays

13 out of 13 users completed this Bite ...
Will you be Pythonista #14 to crack this Bite?
Average Bite difficulty 1-10 rating: 4.0
» Up for a challenge? 💪

In this Bite we use BeautifulSoup to scrape US bank holidays from OfficeHolidays to make a lookup of holidays per month.

Check the HTML (here) for a table with CSS class list-table and parse its data. You need to populate the given holidays defaultdict like this:

  >>> from pprint import pprint as pp
  >>> from holidays import get_us_bank_holidays
  >>> pp(get_us_bank_holidays())
              {'01': ["New Year's Day", 'Martin Luther King Jr. Day '],
               '02': ["Presidents' Day"],
               '04': ['Emancipation Day'],
               '05': ["Mother's Day", 'Memorial Day '],
               '06': ["Father's Day"],
               '07': ['Independence Day '],
               '09': ['Labor Day '],
               '10': ['Columbus Day '],
               '11': ['Veterans Day ', 'Thanksgiving', 'Day after Thanksgiving '],
               '12': ['Christmas Day']})

Have fun and keep coding in Python!

Github login button