Home>

Dan List:

B= [(1,), (2,), (3,), (4,), (5,), (6,)]

As a result, after transformation, the format list should receive: [1, 2, 3, 4, 5, 6]

  • Answer # 1
    >
    ≫
    ≫
     B= [(1,), (2,), (3.4), (5,)]
    ≫
    ≫
    ≫
     B= [INNER_ELEM FOR ELEM IN B FOR INNER_ELEM IN ELEM]
    ≫
    ≫
    ≫
     B.
    [1, 2, 3, 4, 5]
    
  • Answer # 2

    More option

    from operator import itemGetter
    B= [(1,), (2,), (3,), (4,), (5,), (6,)]
    Print (List (ItemGetter (0), B)))
    

    Conclusion:

    [1, 2, 3, 4, 5, 6]
    
  • Answer # 3

    may not be the most effective way, but it looks beautiful:

    >
    ≫
    ≫
     B= [(1,), (2,), (3,), (4,), (5,), (6,)]
    ≫
    ≫
    ≫
     SUM (MAP (List, B), [])
    [1, 2, 3, 4, 5, 6]