Quote:
Originally Posted by boocko
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.