Writing to a file in Python

Writing to a file in Python problem In a program, the data are stored in memory (RAM) and are volatile. In this post we will see how to save (persist) some data so the program can later load them. The data will be stored in a text file. SOLUTION In Python, we can write to […]

Read a file in Python

Read a file in Python problem You’re learning Python and wish to use the file system in your program. With files we can retrieve information from our machine, load it in our program and manipulate it as we like. With a file we can persist data. SOLUTION Let’s suppose we have the following text file. […]