13,420
edits
Changes
→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 erasing the erase existing contents of a file when writing new data to a file. When opening files for writing (i.e. using the ''''w'''' open function attribute), Python assumes existing content in the file is no longer wanted and it's immediately deleted; therefore, if you wish to keep existing write data in to a filebut keep existing content, it is recommended to use the open file attribute ''''a'''' to append new data to a file.}}</blockquote>
::#To start, open the ipython3 shell:<source lang="python">
ipython3