title: Check if url that belongs to the same domain exists in list with python?
body: <p>I wrote a script that parses some entered url on Outgoing links presence. What exactly i need is to check if entered url exists in the list of Outgoing links of specific tag. I do next:</p>
  
  <pre><code>from lxml import html
  import urllib2
  url = 'http://businessinsider.com/'
  
  Testurl = urllib2.urlopen('somequerryurl' +url).read()
  tree = html.fromstring(Testurl)
  
  #this check if specific &lt;li class=""&gt; id tag exists
  Elements = tree.xpath('//div[@id="bd-cross"]//li[@class=""]')
  
  try:
  
      if len(Elements) &gt; 0:
      links = list(tree.xpath('//li[@class=""]//a/@href'))
  
          if url in links:
              print 'Yes'
          else:
              print 'No'
      else:
          print 'No'
  except ValueError:
      print 'Check your entered url!', url
  </code></pre>
  
  <p>For example i've got a list that contains <a href="http://www.businessinsider.com/2007/11/blablabla" rel="nofollow">http://www.businessinsider.com/2007/11/blablabla</a>; <a href="http://www.businessinsider.com/2012/news/blablaba" rel="nofollow">http://www.businessinsider.com/2012/news/blablaba</a>. Script gives me 'No' 'cause url(based on script) not in links - but the correct 'Yes'. What is the best way to check if url that belongs to the same domain exists in list in order to get right result?</p>