View Single Post
Old 09-07-2009, 03:23 PM   #708
cix3
Member
cix3 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Aug 2009
Device: Kindle 2
In a custom recipe, how do I remove multiple div classes?

For example, from this source page (http://www.tnr.com/print/article/pol...ocking-roberts), I want to remove these div classes: print-logo, print-site_name, img-left, and print-source_url.

Probably a simple syntax question, but I'm new to Python. I have tried...

Code:
    remove_tags = [dict(name='div', attrs={'class':'print-logo'})]
    remove_tags = [dict(name='div', attrs={'class':'print-site_name'})]
    remove_tags = [dict(name='div', attrs={'class':'img-left'})]
    remove_tags = [dict(name='div', attrs={'class':'print-source_url'})]
... which only removes the last div class listed (in this case, print-source_url).

This gives me a syntax error:
Code:
    remove_tags = [dict(name='div', attrs={'class':'print-logo', 'print-site_name', 'img-left', 'print-source_url'})]
What is the correct syntax?

Thanks
cix3 is offline