Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 5

4 bytes added, 09:46, 5 September 2017
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')
13,420
edits