alist, blist, clist, dlist, elist = ([] for i in range(5))
The downside of above approach is, you need to count the number of names on the left of =
and have exactly the same number of empty lists (e.g. via the range
call, or more explicitly) on the right hand
side.
The main thing is, don't use something like
alist, blist, clist, dlist, elist = [[]] * 5
nor
alist = blist = clist = dlist = elist = []
which would make all names refer to the same empty list!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…