相关疑难解决方法(0)

enumerate()用于python中的字典

我知道我们enumerate用于迭代列表,但我在字典中尝试过它并没有给出错误.

码:

enumm = {0: 1, 1: 2, 2: 3, 4: 4, 5: 5, 6: 6, 7: 7}

for i, j in enumerate(enumm):
    print(i, j)
Run Code Online (Sandbox Code Playgroud)

OUTPUT:

0 0

1 1

2 2

3 4

4 5

5 6

6 7
Run Code Online (Sandbox Code Playgroud)

有人可以解释输出吗?

python dictionary enumerate python-3.x

40
推荐指数
6
解决办法
9万
查看次数

标签 统计

dictionary ×1

enumerate ×1

python ×1

python-3.x ×1