with open('my_file.txt', 'r') as f:
    print(f.readline())
with open('my_file.txt', 'r') as f:
    print(f.readline())
with open('my_file.txt', 'r') as f:
    print(f.readline())
with open('my_file.txt', 'r') as f:
    pass
Генераторы и циклы for в Python