We can perform simple searches of the DOM using Beautiful Soup's find methods. These methods give us a much more flexible and powerful construct for finding elements that are not dependent upon the hierarchy of those elements. In this recipe we will examine several common uses of these functions to locate various elements in the DOM.
Searching the DOM with Beautiful Soup's find methods
Getting ready
ff you want to cut and paste the following into ipython, you can find the samples in 02/02_bs4_find.py.
How to do it...
We will start with a fresh iPython session...