title: Python - How to read the content of an URL twice?
body: <p>I am using 'urllib.request.urlopen' to read the content of an HTML page. Afterwards, I want to print the content to my local file and then do a certain operation (e.g. constuct a parser on that page e.g. BeautifulSoup).</p>
  
  <p><strong>The problem</strong>
  After reading the content for the first time (and writing it into a file), I can't read the content for the second time in order to do something with it (e.g. construct a parser on it). It is just empty and I can't move the cursor(<em>seek(0)</em>) back to the beginning.</p>
  
  <pre><code>import urllib.request   
  
  
  response = urllib.request.urlopen("http://finance.yahoo.com")
  
  
  file = open( "myTestFile.html", "w")
  file.write( response.read()  )    # Tried responce.readlines(), but that did not help me
  #Tried: response.seek()           but that did not work
  print( response.read() )          # Actually, I want something done here... e.g. construct a parser:
                                    # BeautifulSoup(response).
                                    # Anyway this is an empty result 
  
  
  file.close()
  </code></pre>
  
  <p>How can I fix it?</p>
  
  <p>Thank you very much!</p>