title: Downloading file in python (using urllib and shutil)
body: <p>I was searching for python script to download files and I found 2 ways of downloading with <code>urllib.request.urlopen</code>. One of them use <code>shutil</code> module and the other one not.</p>
  <p>Now I want to know what is the difference between these 2 script?</p>
  <pre><code># 1:
  import urllib
  filedata = urllib.request.urlopen('http://download.thinkbroadband.com/10MB.zip')
  datatowrite = filedata.read()
  with open('10MB.zip', 'wb') as f:
      f.write(datatowrite)
  
  # 2:
  import urllib,shutil
  with urllib.request.urlopen('http://download.thinkbroadband.com/10MB.zip') as response, open(&quot;10MB.zip&quot;, 'wb') as f:
      shutil.copyfileobj(response, f)
  </code></pre>