How to change the major order of lists in python? -


i have list of n lists, each sub-list containing m elements.

how create list of m lists n elements each, containing n-th elements initial lists?

let's have this

mylist = [[1, 2, 3],[4, 5, 6]] 

i want have

[[1, 4],[2, 5],[3, 6]] 

performance important. have sublists of millions of elements (though, 1 dimension small: 1.000.000 x 8 )

this give tuples, it's trivial extend contain lists:

zip(*mylist) 

i.e.

[list(i) in zip(*mylist)] 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -