Skip to content
Advertisement

Webscraping with BeautifulSoup create a dictionary containing author name, car model and all paragraphs with review

I have such a code which gets the values of all paragraphs from a div and inserts them into a list as a new element for each car model year. I wanted to add the possibility of creating a dictionary which would contain values in such form

JavaScript

this dictionary should contain values for different years, so if I specify years to 2017 and 2018 I would like entries in the dictionary for both of those years.

JavaScript

Advertisement

Answer

Here you go, just add it to a dictionary then append the dictionary into your list.

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement