List Items from a Dictionary in Python (Keys, Values, Items) - Python Tutorial for Beginners

preview_player
Показать описание
🎓 Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you Learn Python from A to Z!

🖥️ List Items from a Dictionary in Python (Keys, Values, Items)

There are three dictionary methods that return all of the dictionary’s keys, values and key-value pairs: keys(), values(), and items(). These methods are useful in Loops that need to step through dictionary entries, one by one. All the three methods return iterable objects.

my_dict = {
'age': 27,
'job': 'Youtuber',
'name': 'Digital Academy'
}

○ Get ALL Keys from a Dictionary

# OUTPUT = ['age', 'job', 'name']

○ Get ALL Values from a Dictionary

# OUTPUT = [27, 'Youtuber', 'Digital Academy']

○ Get ALL Items (key, value) from a Dictionary

# OUTPUT = [('age', 27), ('job', 'Youtuber'), ('name', 'Digital Academy')]

Let's play this video, stick around and watch until the end of this video! 👍🏻

- Digital Academy™ 🎓

***

☞ WATCH NEXT:

#Python #Tutorial #Beginners #Shorts

***

♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.

***

♡ FOLLOW US ♡

♡ SUPPORT US ♡

***
Комментарии
Автор

How to Get Keys/Values/Items from a Dictionary in Python? 🤔

DigitalAcademyOnline
Автор

Thanks so much for sharing this video 🙏🏻

xJrmy