【发布时间】:2018-09-15 13:54:15
【问题描述】:
这是我的 Python 代码
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["year"] = 2018
for x in thisdict:
print(x)
它输出:
brand
model
year
我看不懂逻辑!!
【问题讨论】:
-
for x in thisdict产生一个字典键序列。 -
你搜索过“python for in”吗?有一百万个教程涵盖了这一点。
-
@PeterWood 哪种序列?
-
Yash,什么样的序列有关系吗?
-
你可以看到输出是字典的键列表,不是吗?