Convert list of tuples to list?

后端 未结 11 1145
旧巷少年郎
旧巷少年郎 2020-12-02 12:54

How do I convert

[(1,), (2,), (3,)]

to

[1, 2, 3]
11条回答
  •  佛祖请我去吃肉
    2020-12-02 13:34

    There's always a way to extract a list from another list by ...for...in.... In this case it would be:

    [i[0] for i in e]

提交回复
热议问题