![]() |
#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. |
![]() |
![]() |
![]() |
#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 | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,307
Karma: 27111242
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.
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
keep_only_tags | ultimatebuster | Calibre | 4 | 03-19-2010 07:49 PM |