1

I have one long list such as:

m=[[["a", "b"],["c","d"]],[["1", "2"],["3","4"]]]

How could I change it into one list as:

[["a", "b"],["c","d"],["1", "2"],["3","4"]]
blhsing
  • 91,368
  • 6
  • 71
  • 106
Thomas.Q
  • 377
  • 1
  • 4
  • 12

1 Answers1

2

You can use nested list comprehension:

[s for l in m for s in l]

With your sample input, this returns:

[['a', 'b'], ['c', 'd'], ['1', '2'], ['3', '4']]
blhsing
  • 91,368
  • 6
  • 71
  • 106