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 - Python Tutorial
From the course: Build Three Real-World Python Applications
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
-
-
-
What is web scraping?2m 57s
-
Introducing the Wisdom Pet Medicine website2m 4s
-
How to explore a webpage2m 45s
-
(Locked)
Understanding HTML code1m 56s
-
(Locked)
Understanding the requests package3m 8s
-
(Locked)
How to use the get() method2m 38s
-
(Locked)
How to retrieve webpage information4m 4s
-
(Locked)
How to retrieve HTML code1m 36s
-
(Locked)
How to use BeautifulSoup2m 20s
-
(Locked)
How to use find() and find_all() methods3m 52s
-
(Locked)
How to loop find_all() methods3m 21s
-
(Locked)
How to retrieve webpage links2m 18s
-
(Locked)
How to write HTML code to a text file2m 7s
-
-
-
-