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 use find() and find_all() methods - Python Tutorial
From the course: Build Three Real-World Python Applications
How to use find() and find_all() methods
- [Instructor] Now that we have our soup variable, we can begin pulling specific pieces of the HTML code versus pulling all of it at once. We will use the find and find_all methods to accomplish this. These two methods allow us to pull HTML code for a certain tag along with giving us the option to specify certain IDs or classes. The main difference between these two methods is the find method only finds the first time the tag occurs in the HTML code and then it stops scanning the HTML code once it finds it. This is different than the find_all method which scans the entire set of HTML code to find all instances where the tag occurs. We will use the find and find_all tags to find some important information about Wisdom Pet Medicine. This includes the name of the company, the list of services, their phone number, featured testimonials, staff members and web links on the page. To gather the information of which tags to pull…
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
-
-
-
-