Languages
[Edit]
EN

Python - access dictionary items

0 points
Created by:
Molly
321

In this article, we would like to show you how to access dictionary items in Python.

To get the value of a "age" key in my_dict we refer to the key name wrapped with square brackets.

my_dict = {
    "id": 1,
    "name": "Tom",
    "age": 25
}
result = my_dict["age"]

print(result)  # 25

Output:

25
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join