Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 5

3 bytes added, 08:42, 5 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 attributeoption), 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 to use the open file attribute option ''''a'''' in order to append new data to a file.}}</blockquote>
::#To start, open the ipython3 shell:<source lang="python">
ipython3
13,420
edits