Real WorldReading & Writing Files
All courses

Persistent data (until someone rm's it)

Use with open(path, "w") for writing and "r" for reading. The with block closes the file even if an exception fires.

Tip: For JSON, use the json module. For CSV, use csv. Resist parsing CSV with split() unless you enjoy edge cases.

Output
Press Run to execute your code.