View Single Post
Old 01-06-2012, 11:05 AM   #9
vtblogger
Junior Member
vtblogger began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2011
Device: Kindle
Glad I could help.
You're almost there with your next hurdle. Try this:

for a in soup.findAll('a'):
img = a.find('img')

if img is not None:
a.replaceWith(img)
else:
fn = a.find('span',attrs={'class':'fn'})
if fn is not None:
a.replaceWith(fn)
else:
a.extract()
vtblogger is offline   Reply With Quote