How can I make multiple empty lists in Python? [duplicate]
A list comprehension is easiest here: >>> n = 5 >>> lists = [[] for _ in range(n)] >>> lists [[], [], [], [], []] Be wary not to fall into the trap that is: >>> lists = [[]] * 5 >>> lists [[], [], [], [], []] >>> lists[0].append(1) >>> lists [[1], [1], [1], … Read more