SyntaxFix
Write A Post
Hire A Developer
Questions
This works for Python 2 & 3:
from itertools import islice with open('/tmp/filename.txt') as inf: for line in islice(inf, N, N+M): print(line)