Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 16: Working with Files in Python!

Instruction

Writing to files

Opening a file for writing

A file may be opened for reading, allowing no changes, or for writing, allowing changes to occur in the file. The mode defines whether a file is opened for reading only or for writing. The default mode of the open() function is reading only. A second mode parameter defines the mode.

Example: open("output.txt", 'w') opens the output.txt file in writi...