Here is what I get back from this Python line of code
listm = soup.findAll(\'td\',{\'class\':\'thumb\'})
when I iterate over the listm, her
Try this:
listm = soup.findAll('td',{'class':'thumb'})
for elem in listm:
print elem('img')[0]['alt']
This should find the img tag within each td and print the values of the alt attribute.
EDIT:
You should not assume the existence of the img tag. Do this instead:
listm = soup.findAll('td',{'class':'thumb'})
for elem in listm:
imgs = elem('img')
if imgs:
print imgs['alt']
Your td elements contain some nested elements; search for the img tag within each td element, then take the alt attribute with an item lookup:
for td in listm:
img = td.find('img')
if img is not None:
print img['alt']