have small file and you want to manipulate the whole text of that file readline(read the text file line by line and return all the lines as strings readlines(read all the lines of the text file and return them as list of strings close(methodthe file that you open will remain open until you close it using the close(method it' important to close the file that is no longer in use if you don' close the filethe program may crash or the file would be corrupted the following shows how to call the close(method to close the filef close(to close the file automatically without calling the close(methodyou use the with statement like thiswith open(path_to_fileas fcontents readlines(in practiceyou'll use the with statement to close the file automatically reading text file exampleswe'll use the-zen-of-python txt file for the demonstration the following example illustrates how to use the read(method to read all the contents of the the-zen-of-python txt file into stringwith open('the-zen-of-python txt'as fcontents read(print(contentsoutputbeautiful is better than ugly explicit is better than implicit simple is better than complex