11-17-2010, 06:24 PM | #1 |
Junior Member
Posts: 7
Karma: 10
Join Date: Nov 2010
Device: kindle3
|
keep_only_tags and findAll
Hello!
How does keep_only_tags pass parameters to soup's findAll? Is it possible to do something as: soup.findAll('p', limit=3) with keep_only_tags syntax? I want to keep only first div tag with a certain class attribute. |
11-18-2010, 11:38 AM | #2 | ||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
|
||
Advert | |
|
11-18-2010, 11:50 AM | #3 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
you use a dictionary to specify keep only tags, that dictionary is converted to keyword argumets and passed to findAll, so any keyword argument findAll supports, you can use.
|
11-18-2010, 11:59 AM | #4 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
keep_only_tags | ultimatebuster | Calibre | 4 | 03-19-2010 07:49 PM |