I recently, by mistake, found out that if I print out the list( filehandle ) in python for a file open in 'r' mode, it print out a list of all lines of the file.
File trial.txt:
12345
67890
abcd
Code:
a = open("trial.txt", 'r')
print( list(a) )
Output:
['12345\n', '67890\n', 'abcd']
Can anyone explain why this happens?