File I/O
2 / 17
EasyOutput prediction

readlines() vs iterating the file object

A file contains exactly two lines: 'alpha' and 'beta'. What does this code print?

with open("data.txt") as f:
    lines = f.readlines()

print(type(lines).__name__)
print(len(lines))

← → arrow keys to navigate

Sign in to save your progress.