我有这样的代码到目前为止如何把一个列表转换成字典
teamNames = []
teams = {}
while True:
print("Enter team name " + str(len(teamNames) + 1) + (" or press enter to stop."))
name = input()
if name == "":
break
teamNames = teamNames + [name]
print("The team names are ")
for name in teamNames:
print(" " + name)
,但现在我想把teamNames到所创建的空白字典,叫团队,具有零值,但我不知识。
请参阅http://stackoverflow.com/questions/1024847/add-key-to-a-dictionary-in-python – lit