I have a situation here.
What I have is
s = [['A','C','E'],['B','D','F'],...]
I need to merge the string vertically, meaning I need to get the result of
res = [['A','B',..], ['C','D',..],['E','F',..]].
How do I get it ?
Thank you
I have a situation here.
What I have is
s = [['A','C','E'],['B','D','F'],...]
I need to merge the string vertically, meaning I need to get the result of
res = [['A','B',..], ['C','D',..],['E','F',..]].
How do I get it ?
Thank you
You could use zip
method in combination with unpacking
operator.
res = [list(item) for item in zip(*s)]
Output
> res
[['A', 'B'], ['C', 'D'], ['E', 'F']]