File objects - readlines() [SOLVED] | SoloLearn: Learn to code for FREE!


File objects - readlines() [SOLVED]

I am confused about size arguements of readlines. So these are contents of my txt file:- 123 456 789 098 xyz When I used 4 as arguement , it included the 2nd line in list. But when I used 7 as arguement it didn't include 3rd line , 8 did. Then I used 11 as arguement as it should've included 4th line(8+3=11) , but it didn't , 12 did. And this patterns goes on and on... Am I missing something or there's something wrong with my IDE(I tried both IDLE and PyCharm)?

8/4/2019 4:01:39 PM

Ayush Gupta

2 Answers

New Answer


One line contains 4 Bytes of data (three characters and one linefeed /n). So readlines() with arguments 4,8,12 will read the following line.


Michael Thanks buddy!