入れ子になっているリストから入れ子を外す方法 2023年5月29日 / 1 min read View more blogs with the tag python Table of Contents #はじめに #方法 はじめに Pythonで入れ子になっているリストから入れ子を外す方法です。 方法 import itertools old_list = [[0, 1], [2, 3], [4, 5, 6]] new_list = list(itertools.chain.from_iterable(old_list))# -> [0, 1, 2, 3, 4, 5, 6]