following book on python

at one place in the book there a command to ead a txt file

like this
open (‘myfile.txt’).readlines()

but then what do you do with this
i mean does it read all the lines in the file ?
does it take care of the end of file by itself?

can we print the number of lines in the file or get one specific item and how?
is htere more doc giving more details about how to use this?


Python ‘open’ is aliased to ‘file’, which might be some of your confusion. There is documentation here:

readlines() returns a list of all lines in the file and takes care of EOF. Because it returns a list you can use python primitives, i.e. len(), on the list to get the number of elements.