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

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