View Single Post
Old 11-18-2010, 11:38 AM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Thumbs up

Quote:
Originally Posted by boocko View Post
Is it possible to do something as:
soup.findAll('p', limit=3)
with keep_only_tags syntax?
It's an interesting question, and one I don't know the answer to.

Quote:
I want to keep only first div tag with a certain class attribute.
If there's only one of them, you can define it easily without the limit, but I assume there's more than one. You can always remove_tags_after the tag of interest. Or you can preprocess_html and use findAll with the limit parameter directly.
Starson17 is offline   Reply With Quote