Browse Source

Dict

pull/3/head
Jure Šorn 6 years ago
parent
commit
b0793f771a
1 changed files with 1 additions and 6 deletions
  1. 7
      README.md

7
README.md

@ -40,14 +40,9 @@ Dictionary
<dict>.update(<dict>)
```
```python
>>> a = [('x', 4), ('y', 5)]
>>> dict(a)
{'x': 4, 'y': 5}
```
```python
collections.defaultdict(<type>) # Creates a dictionary with default values.
dict(<list>) # Initiates a dict from list of key/value pairs.
dict(zip(keys, values)) # Initiates a dict from two lists.
{k: v for k, v in <dict>.items() if k in <list>} # Filters a dict by keys.
```

Loading…
Cancel
Save