BeautifulSoup and Python have evolved, so if someone comes here with newer versions:
Python>=3.7
BeautifulSoup>=4.7
Here's updated code that works:
# import bs4 and create your 'soup' object
table = soup.find('table')
headers = [header.text for header in table.find_all('th')]
results = [{headers[i]: cell for i, cell in enumerate(row.find_all('td'))}
for row in table.find_all('tr')]