13,420
edits
Changes
→PART 2 - Writing To Files
cp file2.txt.bk file2.txt
cat file2.txt
</source><br>In the event that the data in the file is important and should not be overwritten, we can '''append''' data to the end of the file instead. Use the option 'a' instead of 'w' to perform appending.<br><br></li>
<li>To demonstrate, issue the following commands:<source lang="python">
f = open('file1.txt', 'a')