Given the following list of lists:
iters=[['EY11', 'EY12', 'EY13', 'EY14'],
['EY21', 'EY22', 'EY23', 'EY24'],
['PY11', 'PY12', 'PY13', 'PY14'],
['PY21', 'PY22', 'PY23', 'PY24']]
I'd like to modify this list to transpose the values (for lack of a better description) like this:
iters=[['EY11', 'EY21', 'PY11', 'PY21'],
['EY12', 'EY22', 'PY12', 'PY22'],
['EY13', 'EY23', 'PY13', 'PY23'],
['EY14', 'EY24', 'PY14', 'PY24']]
I can do this with one sub-list at a time like this:
[i[0] for i in iters]
but now I just need to know how to iterate through each sub-list and automatically make the new list of lists (also, I can't predict how many sub-lists there will be in my actual data, so I'd like to avoid hard-coding the current number of sub-lists in i[0].
Thanks in advance!