python 2.7 - zipping a list of lists according to index? -
How can I use zip
to zip a list of lists by index? ?
zip (a, b, c)
print [('f', 'h', 's'), ('o', 'e', 't' ), This is what I need to do ('u', 'l', 'a'), ('r', 'p', 'k')]
however zip (k)
print [(['f', 'o', 'u', 'r'],), (['h' , 'E', 'L', 'P'],), (['s,' t ',' a ',' k '],)]
does not do.
Is there a list int " brake up " Is this a separate piece for zip function?
I need a list, this is a simple example, for unknown quantities in Kashmir, where I am using it.
Try the following code:
zip (* [lists. .])
You can put any number of lists in there (can easily be generated using list comprehension)
Comments
Post a Comment