Skip to content
Advertisement

web scraping amazon reviews precents bs4

So I’m Trying To Get The Review Precent Of Each Amount of Stars In an Amazon Product Page.

This Is The Output I want To Get:

JavaScript

And So Far This Is The Output I Got:

JavaScript

As You see, I Have Managed To Get The Awesome Feedback Working But Not The Other Ones… The problem is that I got all the precentages in isolated list and every precntage has his one list. As you see here:

JavaScript

I’m quite straggling with it… If there is a way to access all of the indexes of the for loop and merge them all into one list, please share it with me… here is my code:

JavaScript

Advertisement

Answer

There are two Options #1 define pd as empty list outside the loop, append each result of iteration and also print outside the loop or do the following:

Example

JavaScript

Output:

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