title: Extracting string from a href tag with Python 2.7x
body: <p>I am currently using Beautifulsoup4 to extract 'a href' tags from a HTML page. I am using the find_all query in Beautifulsoup4 and it's working fine and returning the 'a href' tags I'm looking for. An example of what is returned is below:</p>
  
  <pre><code>"&lt;a href="manage/foldercontent.html?folder=Pictures" style="background-image: url(shares/Pictures/DefaultPicture.png)" target="content_window" title="Vaya al recurso compartido Pictures"&gt;Pictures&lt;/a&gt;"
  </code></pre>
  
  <p>What I'm looking to now do however is simply extract <code>"&lt;a href="manage/foldercontent.html?folder=Pictures"</code> as opposed to the full content returned as above. </p>
  
  <p>My code is below:</p>
  
  <pre><code>req = urllib2.Request(example_url)
  response = urllib2.urlopen(req)
  soup = BeautifulSoup(response.read(), from_encoding=response.info().getparam('charset'))
  for link in soup.find_all('a', href=True):
      # The below 'if' is to filter out only relevant 'a href' tags
      if "foldercontent.html?folder" in link['href']: 
          print link
  </code></pre>
  
  <p>Is this possible with modifying what I search for or would I have to run a regex across my returned string?</p>