Mar
13

the crazy * in zip()

I just want to reshape the List without use the numpy, so I found a piece of crazy code in stackoverflow:

l = ['a', 'b', 'c', 'd', 'e', 'f']
zip(*[iter(l)]*2)

output: [(‘a’, ‘b’), (‘c’, ‘d’), (‘e’, ‘f’)]

After the long consideration, I understand the code at last. The python programmer are really …

Written by connygy. Posted in python

Trackback from your site.

Leave a comment