gruntfutuk Wrote:How about: (using Python 3)Now do itertools also work for Python 2,and i guess he use Python 3 bye his use of print function.
itertools.islice is cool @gruntfutuk,but for this i had gone for a more simplistic approach as shown in other post with enumerate.
with open('in.txt') as f: for count,line in enumerate(f, 1): if count % 2: print(len(line.strip()))