Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 5

19 bytes removed, 22:32, 10 September 2017
PART 2 - Writing To Files
:'''Perform the Following Steps:'''
<blockquote style="margin-left:35px;">{{Admon/caution|style="padding-left:25px"|Risk of Losing File Contents|A common problem that new Python programmers may encounter is to accidentally erase existing contents of a file when writing new data to a file. When opening files for writing (using the ''''w'''' open function option), Python assumes existing content in the file is no longer wanted and it's immediately deleted; therefore, if you wish to write data to a file but keep existing content, it is recommended you need to use the open file option ''''a'''' in order to (append new data to a file).}}</blockquote>
::#To start, open the ipython3 shell:<source lang="python">
ipython3