title: Look for an string inside a webpage without saving it in a file?
body: <p>I'm new with Python and I have some questions!!</p>
  
  <pre><code>def extractdownloadurl(url):
  
      uresponse = urllib2.urlopen(url) #open url
      contents = uresponse.readlines() #readlines from url file
      fo = open("test.html","w") #open test.html
      for line in contents: 
          fo.write(line)#write lines from url file to text file
      fo.close()#close text file
  
      cadena = os.system('more test.html | grep uploads | grep zip &gt;&gt; cadena.html')
  
      f = open("cadena.html","r")
      text = f.read()
      f.close()
  
  
      match = re.search(r'href=[\'"]?([^\'" &gt;]+)', text)
      if match:
          cadena=match.group(0)
  
  
      texto = cadena[6:]
  
  
      os.system('rm test.html')
      os.system('rm cadena.html')
      return texto
  </code></pre>
  
  <p>This is my function to download a webpage and take one url following some conditions. It works. But I want to apply a more efficient way than saving the web on a file. I want to make something similar to a grep without save and read files (It's really slow). And other faster way of copy the url to a string.</p>
  
  <p>Please write the code to look for a url inside contents without saving contents into a file.</p>
  
  <p>I know that there are a lot of questions but I would be very grateful if you answer all of then.</p>