Yesterday, I wrote a short guide on how to write to a file using Python. Today, you will learn how to read this file.
the_file = open('the_file.txt', 'r') lines = the_file.readlines()
Now you have a variable called lines. This is a list of the lines. To print them, you can do this:
for line in lines: print(line)