小编idk*_*idk的帖子

使用和不使用keys()方法对字典键进行迭代之间的区别

.keys()Python中带方法和不带方法的字典中的for循环有什么区别.keys()

thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
for i in thisdict:
    print(i)
for i in thisdict.keys():
    print(i)
Run Code Online (Sandbox Code Playgroud)

有什么不同?

python dictionary for-loop key

6
推荐指数
2
解决办法
799
查看次数

标签 统计

dictionary ×1

for-loop ×1

key ×1

python ×1