0

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

Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128

1 Answers1

1

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']]
Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128