Trying to make a function that copies the content of one file and writes it to another
<p>I have a question that states
<strong>Write a function fcopy() that takes as input two file names (as strings) and copies the content of the first file into the second.</strong>
and I want to know how to go about solving this.</p>

<p>My first file is named example, and the second file is named output, both text files are in .txt format, and the path to them are 
<em>"C:\Users\HOME\Desktop\Introduction to Computing\Lab\assignments\example.txt"</em>
and <em>"C:\Users\HOME\Desktop\Introduction to Computing\Lab\assignments\output.txt"</em></p>

<p>You are not to ask StackOverflow to do your homework for you. Feeling generous though...</p>

<p>First of all, read this: <a href="https://docs.python.org/3.3/library/shutil.html" rel="nofollow">https://docs.python.org/3.3/library/shutil.html</a> It's the Python 3 docs for the shutil module. It will give high-level functions for reading/writing files (I/O).</p>

<pre><code>from shutil import copyfile
copyfile(locationOfSource, locationOfDestination)
</code></pre>

<p>An important thing to note is that "\" (back-slash) signifies non-literal text, so "\n" means new line, NOT just "\n". This is rarely mentioned and had me stumped when I first learnt escape characters. To do the back-slash that you want within a string, you MUST use "\" instead of "\".</p>

<p>The commenters below your answer are correct, please read the information given to you by StackOverflow about asking questions. Also, welcome to the site.</p>

python python-3.x