After "print(file.read (16))" does "print(file.read read(4))" start on the 17th byte? or start back at the 1st? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

After "print(file.read (16))" does "print(file.read read(4))" start on the 17th byte? or start back at the 1st?

In question 2/4 the code writes: file = open("filename.txt","r") print(file.read (16)) print(file.read (4)) print(file.read (4)) print(file.read (4)) file.close () Does the program read 16 bytes and start over when it gets on the next line or does it continue where it left off?

28th Jan 2016, 6:53 PM
Victor Noe Mendoza
Victor Noe Mendoza - avatar
4 Answers
+ 3
After 16 bytes it will start from 17th when the next read() is encountered as the pointer is now on 17th byte and no command has been given to move it back to the top again.
17th Apr 2016, 11:35 AM
Rishi Pathania
Rishi Pathania - avatar
0
it starts where it left off
17th Mar 2016, 9:35 PM
Ayomide Adeoye
Ayomide Adeoye - avatar
0
Yeah it will start where it left off
17th Apr 2016, 7:04 PM
Niloy
Niloy - avatar
- 6
from the 1st i think
5th Mar 2016, 4:37 PM
Michael Amir