This IPython notebook contains the basic concepts of Dictionary in python like how to create dictionary, how to access the key:value of the dictionary and how to modify dictionary.
Dictionary in python is Mutable and Unordered colletion of data values which is used to store data values in {key:value} pairs.
set of built-in methods in python that we can apply on dictionary
| Method | Description |
|---|---|
| keys() | Returns a list containing the dictionary's keys |
| values() | Returns a list containing the dictionary's keys |
| items() | Returns a list containing a tuple for each key value pair |
| copy() | Returns a copy of the dictionary |
| clear() | Removes all the elements from the dictionary |
| get() | Returns the value of the specified key |
| pop() | Removes the element with the specified key |
| update() | Updates the dictionary with the specified key-value pairs |
| len() | Returns the number of Key/Value pairs |
| popitem() | Removes the last inserted key-value pair |
| fromkeys() | Returns a dictionary with the specified keys and value |