All right.
Welcome back.
One final short lecture before we wrap up the section.
It's worth knowing that the find all and select methods we've explored so far also have a pair of sister
methods that work exactly like them, but rather return only the first match instead of a python list
of all matches.
So first there's the find method, which works exactly like find all.
With limits set to one.
So let's say Snoop Dogg find all and let's go for the anchor tags, but limit the results to one.
So we only get the first anchor tag and then that is exactly or I should say, rather very similar to
saying find a.
All right.
These are exactly the same elements.
Right.
But notice that fine double always returns a list regardless of the number of matches.
Whether it finds zero one or 100 tags find all will always return a list of Python list.
Whereas find returns a single tag if it finds one or none.
If it does not write.
So.
We can actually confirm that these are exactly the same tags.
If we get the first element of that list that find all returns.
And using the ease keyword in Python, we can check for identity between these two and enough they are
the same.
Cool.
Similarly, Select has its singular sister method in select one.
So let's select all the anchors.
Anything.
The result?
One.
We got again a python list containing all the elements.
And that first element that we get there is exactly what would be returned if we said select one anchor.
And so these two are also exactly the same thing.
Is.
So again, we see here that the setup is quite similar in that select returns a list, whereas select
one returns either a tag or nothing at all.
Right.
In all other respects, the find all and select methods work exactly the same as their singular counterparts.
So if you're familiar with find all method, you'll also automatically know find.
And the same goes for select and select one.
The only thing to keep in mind is that the singular methods return a single tag or none, whereas the
plural methods always return python lists, which could be empty lists or full of matched element tags.