Splitting Python List -


i want split list below:

my_list = [(55, 22), (66, 33), (77, 44)] 

i have tried:

a, b = my_list 

this did not work.

what need is:

a = [55,66,77] b = [22,33,44] 

i looking simplest , easiest way.

in [18]: l = [(55, 22), (66, 33), (77, 44)]  in [19]: a,b = zip(*l)  in [20]: out[20]: (55, 66, 77)  in [21]: b out[21]: (22, 33, 44) 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -