Given the function
def line2fields(line):
fields = []
i = 1
while i < len(line):
fields.append(line[i:i+23])
i += 24
return fields
Rewritten in list comprehension:
def line2fields(line):
fields = []
i = 1
while i < len(line):
yield i
i += 24
I am still learning python and want to know if i got this list comprehension right?