我如何以一种双水平的节奏曲方式来初始化一个列表呢?
pos = defaultdict(dict)
pait = "2:N"
cars = ["bus","taxi"]
for x in cars:
pos[x][pait]=[]发布于 2016-10-14 12:40:19
Python的列表和字典理解对于一行初始化非常有用。
pos = {x: {"2:N": []} for x in ["bus", "taxi"]}https://stackoverflow.com/questions/40043288
复制相似问题