Hi,
1) I want to iterate over a list "N at a time"
sort of like:
# Two at a time... won't work, obviously
[color=blue][color=green][color=darkred]
>>> for a, b in [1,2,3,4]:[/color][/color][/color]
.... print a,b
....
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
TypeError: unpack non-sequence[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Is there a nifty way to do with with list comprehensions,
or do I just have to loop over the list ?
cheers and thanks
chris wright
1) I want to iterate over a list "N at a time"
sort of like:
# Two at a time... won't work, obviously
[color=blue][color=green][color=darkred]
>>> for a, b in [1,2,3,4]:[/color][/color][/color]
.... print a,b
....
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
TypeError: unpack non-sequence[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Is there a nifty way to do with with list comprehensions,
or do I just have to loop over the list ?
cheers and thanks
chris wright
Comment