title: Python: read() method of urllib.request.urlopen()
body: <p>I was playing around with <code>urllib.request</code> module when I found that calling <code>read()</code> method on a <code>urllib.request.urlopen()</code> object results in no response the second time:</p>
  
  <p><strong>code:</strong></p>
  
  <pre><code>import urllib.request
  
  url = 'http://www.youtube.com'
  resp = urllib.request.urlopen(url)
  
  print(len(resp.read()))  # first call
  print(len(resp.read()))  # second call
  </code></pre>
  
  <p><strong>output:</strong></p>
  
  <pre><code>549444
  0
  </code></pre>
  
  <p>I can't find any documentation regarding <code>read()</code> method, I want to better understand what exactly is happening in the above code. An obvious fix might be to call the <code>urlopen()</code> method again but this would be inefficient.</p>