Changes

Jump to: navigation, search

OPS435 Python Lab 5

121 bytes added, 07:54, 5 September 2017
PART 2 - Writing To Files
== PART 2 - Writing To Files ==
There is a danger involved in this next section, when opening files for writing, Python assumes content in the file is no longer wanted and it's immediately deleted. If the file contents are important, append to the file instead.
:'''Perform the Following Steps:'''
:x <blockquote style="margin-left:35px;">{{Admon/caution|style="padding-left:25px"|xRisk of Losing File Contents|ExA common problem that new Python programmers may encounter is accidentally erasing the existing contents of a file when writing data to a file. When opening files for writing, Python assumes content in the file is no longer wanted and it's immediately deleted; therefore, if in doubt, append new data to the file instead!}}</blockquote>
::#To start, open the ipython3 shell:<source lang="python">
ipython3
13,420
edits

Navigation menu