title: Beautifulsoup of href
body: <p>Can someone please advise how do i retrieve href and img values from <code>&lt;td&gt;</code> . I have written the following piece of code to retrieve the result as given below. I am able to retrieve the value till <code>&lt;td&gt;</code>. I'm not sure how to retrienve further. </p>
  
  <p>Please note there are a lot of <code>&lt;tr&gt;</code>values . I have just given two as an example.</p>
  
  <p>MyCode:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import urllib2
  url="http://mywebsite.com/"
  page=urllib2.urlopen(url)
  soup = BeautifulSoup(page.read())
  
  records = [] 
  tabledata = soup.find("table", {"class" : "class1"})
  for row in tabledata.findAll('tr'):
      col = row.findAll('td')
      if col:
          col1 = col[1].string.strip()
          col2 = col[2].string.strip()
          col3 = col[3].string.strip()
          record = '%s %s %s' % (col1,col2,col3)
          records.append(record)
  
  
  for values in records:
      print values
  </code></pre>
  
  <p>data</p>
  
  <pre><code>&lt;table class="class1"&gt;
  &lt;tr&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th&gt;Heading1&lt;/th&gt;
  &lt;th&gt;Heading2&lt;/th&gt;
  &lt;th&gt;Heading3&lt;/th&gt;
  &lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;img src="http://image.com/new.png"/&gt;&lt;/td&gt;
  &lt;td&gt;Data1&lt;/td&gt;
  &lt;td&gt;&lt;a href="www.sample.com"&gt;Data2&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;Data3&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Data1 Data2 Data3
  </code></pre>
  
  <p>Required Output:</p>
  
  <pre><code>Data1 Data2 Data3 www.sample.com new.png
  </code></pre>