Browse Source

Dictionary

pull/10/head
Jure Šorn 6 years ago
parent
commit
264915cebb
1 changed files with 4 additions and 4 deletions
  1. 8
      README.md

8
README.md

@ -61,10 +61,10 @@ Dictionary
```
```python
value = <dict>.get(key, default) # Returns default if key does not exist.
value = <dict>.setdefault(key, default) # Same, but also adds default to dict.
<dict> = collections.defaultdict(<type>) # Creates a dictionary with default value of type.
<dict> = collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1.
value = <dict>.get(key, default) # Returns default if key does not exist.
value = <dict>.setdefault(key, default) # Same, but also adds default to dict.
<dict> = collections.defaultdict(<type>) # Creates a dictionary with default value of type.
<dict> = collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1.
```
```python

Loading…
Cancel
Save