title: Copy file in Python - Read-write vs Shutil.copy
body: <p>I tried to copy file using the read and write function I just learnt, as below:</p>
  <pre><code>from sys import argv
  
  script, from_file, to_file = argv
  a = open(from_file).read()
  a = open(to_file, 'w').write(a)
  </code></pre>
  <p>Then, I googled a bit and found out there's shutil module that consists of copy and copyfile.</p>
  <p>My doubts are:</p>
  <ol>
  <li><p>How does 'read' function in the code above <em>acts</em> as 'copy' function?</p>
  </li>
  <li><p>If read &amp; write function = copy &amp; paste, why do we need <code>shutil.copy()</code> / <code>shutil.copyfile()</code>? In what circumstances do we use shutil.copy?</p>
  </li>
  </ol>