Languages
[Edit]
EN

Python - access dictionary items

0 points
Created by:
Molly
201

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
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