Python memperluas daftar bersarang
# credit to the Stack Overflow user in the source link
"""Note: using 'chain' is about 20% faster than nested looping"""
from itertools import chain
nested_list = [[1,2,3], [4,5,6], [7], [8,9]]
expanded_list = list(chain(*nested_list))
expanded_list
>>> [1,2,3,4,5,6,7,8,9]
wolf-like_hunter