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 …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.