I need to read in only every second line of a file (which is very big) so I don\'t want to use readlines(). I\'m unsure how to implement the iterator so any sug
readlines()
You can use a custom iterator:
def iterate(pth): for i, line in enumerate(pth, 1): if not i % 2: yield line