+ 2

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)?

4th Aug 2019, 4:01 PM
Ayush Gupta
Ayush Gupta - avatar
2 odpowiedzi
+ 1
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.
4th Aug 2019, 4:26 PM
Michael
Michael - avatar
0
Michael Thanks buddy!
4th Aug 2019, 4:43 PM
Ayush Gupta
Ayush Gupta - avatar