open(method secondyou have to read the text from the text file using the file read()readline()or readlines(method of the file object thirdyou have to close the file using the file close(method open(function the open(function has many parameters but you'll be focusing on the first two open(path_to_filemodethe path to the file parameter is specifies the path to the text file if the file is in the same folder as is programyou have just need to specify the file name otherwiseyou have need to specify the path to the file specify the path to the fileyou have to use the forward-slash ('/'even if you are working in windows exampleif the file is in the readme txt stored in the sample folder as the programyou have need to specify the path to the file as :/sample/readme txt mode is in the optional parameter this is the string that is specifies the mode in which you want to open the file the following table shows available modes for opening text filemode description 'ropen for text file for reading text 'wopen text file for writing text 'aopen text file for appending text for exampleto open file whose name is the-zen-of-python txt stored in the same folder as the programyou use the following codef open('the-zen-of-python txt',' 'the open(function returns file object which you will use to read text from text file reading text methodsthe file object provides you with three methods for reading text from text file