Module 7

Writing a text file

Saving data to a file.

Saving data

You can also write data to a file. You open the file in write mode and use the write() method.

PythonWriting to a file (conceptual).
# Conceptual example:
# f = open("output.txt", "w")
# f.write("Hello")
# f.close()

What mode do you use to write to a file?