Python - File Reading and Writing Strategies
What will be the output of this code snippet when reading a large file in chunks?
with open('largefile.txt', 'r') as f:
chunk = f.read(5)
print(chunk)
chunk = f.read(5)
print(chunk)What will be the output of this code snippet when reading a large file in chunks?
with open('largefile.txt', 'r') as f:
chunk = f.read(5)
print(chunk)
chunk = f.read(5)
print(chunk)f.read(5) reads 5 characters from the current file position.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions