Helper method to easily select a single element via CSS
Bug #1349367 reported by
Dan Watkins
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I often find myself writing code like this:
elements = parent_
self.assertEqual(1, len(elements))
element = elements[0]
Being able to do:
element = parent_
would make this much more expressive.
Changed in beautifulsoup: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Added in revision 371. This has brought to light a naming inconsistency: find()/find_all() find one/many tags, but select( )/select_ one() find many/one tags. But it's way too late to change those names.