How to use a Python dictionary?

前端 未结 7 1043
闹比i
闹比i 2020-12-11 21:24

I am finding it difficult to iterate through a dictionary in python.

I have already finished learning via CodeAcademy and solo learn but still find it tough to go th

7条回答
  •  失恋的感觉
    2020-12-11 21:54

    If you are using Python 2

    for key, value in d.iteritems():
    

    For Python 3

    for key, value in d.items():
    

    As usual the documentation is the best source for information Python 2 Python 3

提交回复
热议问题