Simon S Simon S - 1 year ago 65
Python Question

Print list of lists in Python in specific order

I have this list:

vshape = [['0','1','1'],['1','0','1'],['1','1','0'],['1','0','1'],['0','1','1']]

I need to print out every item in specific order -
one line of vshape[0][0], vshape[1][0], vshape[2][0], vshape[3][0], and vshape[4][0];
followed by line of vshape[0][1], vshape[1][1] ans so on...

Output should look like ('0's creating a V-shape):


Answer Source

Use zip:

for r in zip(*vshape):

# 01110
# 10101
# 11011
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download