When should I ever use file.read() or file.readlines()?
The short answer to your question is that each of these three methods of reading bits of a file have different use cases. As noted above, f.read() reads the file as an individual string, and so allows relatively easy file-wide manipulations, such as a file-wide regex search or substitution. f.readline() reads a single line of … Read more