How to join nested list of strings and get the result as new list of string?

后端 未结 4 1833
忘了有多久
忘了有多久 2021-01-07 02:24

I am having nested list of strings as:

A = [[\"A\",\"B\",\"C\"],[\"A\",\"B\"]]

I am trying to join the strings in sublist to get a single l

4条回答
  •  时光说笑
    2021-01-07 02:47

    You can try this:

    A = [["A","B","C"],["A","B"]]
    new_a = [[''.join(b)] for b in A]
    

    Output:

    [['ABC'], ['AB']]
    

提交回复
热议问题