for i, line in enumerate(file('myfile.txt')):
if i % 5 in (0, 1):
print line
if i % 5 in (0, 1):
print line
f = open('filename.txt', 'r')
for index, line in enumerate(f.readlines()):
if index%5 <= 1:
print(line)