From the course: Build Three Real-World Python Applications

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

How to loop find_all() methods

How to loop find_all() methods

- [Instructor] Now we will use for loops to iterate through some of our find_all statements to provide a better formatted output compared to how we made the find_all output earlier. In this Jupyter Notebook cell, we will begin typing out our code. So, first, we are going to create our variable, featured_testimonial. We're going to equal that to our soup variable and do a .find_all method on it. And, for this method, we want to find the div tag for the class equal to quote. This first portion of the code is similar to the structure of our phone number example, where we are essentially pulling in the information for all of the times we can find the div tag with the class quote. Next, we're going to begin our for loops. So we're going to start off with the word for to tell Python we want to do a for loop. Then we have our iterator. Again, this is something, on your own, you can name whatever you wish, but in this…

Contents