Flatten a list in python

前端 未结 7 1387
逝去的感伤
逝去的感伤 2020-12-06 19:14

I have a list like this:

[[(video1,4)], [(video2,5),(video3,8)], [(video1,5)], [(video5, 7), (video6,9)]...]

each item in this list may con

7条回答
  •  执笔经年
    2020-12-06 20:10

    If you just want to flatten the list, just use itertools.chain.from_iterable: http://docs.python.org/library/itertools.html#itertools.chain.from_iterable

提交回复
热议问题