This method is read until the EOF uses readline () to return a list containing rows. If the optional sizehint parameter exists, instead of reading to EOF, the entire row is approximately sizehint bytes read (possibly rounded to the size of the internal buffer ). syntax: fileObject. readlines (sizehint); parameter: The following is a detailed parameter: sizehint: the number of bytes read from the file. instance :#! /Usr/bin/python # Open a filefo = open ("foo.txt", "r") print "Name of the file:", fo. name # Assuming file has following 5 lines # This is 1st line # This is 2nd line # This is 3rd line # This is 4th line # This is 5th line = fo. readlines () print "Read Line: % s" % (line) line = fo. readlines (2) print "Read Line: % s" % (line) # Close opend filefo. close () will produce the following results: Name of the file: foo.txt Read Line: ['this is 1st line \ n', 'this is 2nd line \ n ', 'This is 3rd line \ n', 'this is 4th line \ n', 'this is 5th line \ n'] Read Line: []