TIL differences between reading in files using Python

In passing, a colleague at work was looking at my code and explained how the three read file modules: read(), readline(), and readlines() are different.

But I was focusing intently on the code and didn’t quite catch what the differences were. So afterwards, I did some googling and figured it out. [This page](https://www.digitalocean.com/community/tutorials/how-to-handle-plain-text-files-in-python-3) lays it out nice and clear. I’ll also post this link under Resources –> NLP and Data Science.

In short, the following are the differences:
* f.read() –> returns entire contents of the file as a single string
f.readline() –> will read a file line-by-line, and returns one line
f.readlines() –> returns a list of lines from the file, where each item in the list is a line

From that same article, something to bear in mind:

Something to keep in mind when you are reading from files, once a file has been read using one of the read operations, it cannot be read again. For example, if you were to first run days_file.read() followed by days_file.readlines() the second operation would return an empty string. Therefore, anytime you wish to read from a file you will have to first open a new file variable.