Here is what I get back from this Python line of code
listm = soup.findAll('td',{'class':'thumb'})
when I iterate over the listm, here is an example of a item…
<a href="/property-search/property-details/1021206?StrtNum=1507"><img alt="1507 BOSTWICK LN" src="/res/slir/w75-h57-c4:3/propertyimages/20120904/BB/DSCN0738.JPG"/></a>
However, what I really want is the “1507 BOSTWICK LN” within the <img alt=
I have tried the .get_text with returns a blank, I’ve tried
lista = soup.findAll('td',{'class':'thumb'},{'alt':'img'}), and several other variations that do not get me the text.
I would like to have BeautifulSoup return the text, or would a regular expression work? My knowledge of of RE is zilch, any input would greatly be appreciated!!
Try this:
This should find the
imgtag within eachtdand print the values of thealtattribute.EDIT:
You should not assume the existence of the
imgtag. Do this instead: