# flatten list of lists
ls = [['a','b','c'],['d','e','f'],['g','h','i']]
# iterate through list of lists in a nested loop
flat_ls = []
for i in ls:
    for j in i:
# print
print("Original list:", ls)
print("Flattened list:", flat_ls)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter