alist, blist, clist, dlist, elist = ([] for i in range(5))
The disadvantage of the above approach is that you need to count the number of names to the left of = and have exactly the same number of empty lists (for example, by calling range or more explicitly) on the right hand side.
The main thing is not to use something like
alist, blist, clist, dlist, elist = [[]] * 5
neither
alist = blist = clist = dlist = elist = []
in which all names will refer to the empty same list!
Alex Martelli Mar 08 2018-10-10T00: 00Z
source share