小编ZrS*_*iO4的帖子

迭代字典

这两个设置使用print(i, j)print(i)返回相同的结果.是否有人应该使用另一个或者交替使用它们是否正确?

desc = {'city': 'Monowi', 'state': 'Nebraska', 'county':'Boyd', 'pop': 1}

for i, j in desc.items():
 print(i, j)

for i in desc.items():
 print(i)
Run Code Online (Sandbox Code Playgroud)
for i, j in desc.items():
 print(i, j)[1]

for i in desc.items():
 print(i)[1]
Run Code Online (Sandbox Code Playgroud)

python iteration python-2.x

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

iteration ×1

python ×1

python-2.x ×1