-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9_dictionary_methods.py
18 lines (17 loc) · 1.03 KB
/
9_dictionary_methods.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Python Dictionary Methods
# Dictionary Methods
'''
Python has a set of built-in methods that you can use on dictionaries.
Method Description
clear() Removes all the elements from the dictionary
copy() Returns a copy of the dictionary
fromkeys() Returns a dictionary with the specified keys and value
get() Returns the value of the specified key
items() Returns a list containing a tuple for each key value pair
keys() Returns a list containing the dictionary's keys
pop() Removes the element with the specified key
popitem() Removes the last inserted key-value pair
setdefault() Returns the value of the specified key. If the key does not exist: insert the key, with the specified value
update() Updates the dictionary with the specified key-value pairs
values() Returns a list of all the values in the dictionary
'''