Three methods to read a file
-
read()
It returns the read bytes in form of a string.fileObject.read()
You can also define, how many bytes to read by
`fileObject.read([n]) //If n is not define, it will read the whole file`
-
readline([n])
It reads the line and return in the form of string, It only read single linefileObject.readline([n])
-
readlines()
It reads all the lines of the file and return each line a string element in a listfileObject.readlines()
Hope it helps