I have an input like this:
x = '415,252,428,233,428,214,394,207,383,205,390,195'
And I want to end up with this
y = [(415,252),(428,233),(428,214),(394,207),(383,205),(390,195)]
The closes I got is
tmp = [int(i) for i in x.split(',')] y = zip(tmp[::2], tmp[1::2])
How do I get rid of the intermediate list? I need alternative to
[::2] that could be used on a generator.