Python Dictionary Methods - clear() get() update() and pop() with Code Examples - Learn Programming

Опубликовано: 03 Ноябрь 2021
на канале: Appficial
1,001
11

There are several useful dictionary methods:

my_dict.clear() - Clears (removes) all items from the dictionary

my_dict.get(key, default) - Gets the value of the specified key. If the key does not exist in the dictionary, then returns default.

my_dict1.update(my_dict2) - Merges dictionary my_dict1 with another dictionary my_dict2. Existing entries with the same key in my_dict1 are overwritten by my_dict2

my_dict.pop(key, default) - Removes and returns the key-value from the dictionary. If key does not exist, then default is returned

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!


На этой странице сайта вы можете посмотреть видео онлайн Python Dictionary Methods - clear() get() update() and pop() with Code Examples - Learn Programming длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Appficial 03 Ноябрь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,001 раз и оно понравилось 11 зрителям. Приятного просмотра!