Browse Source

Defaultdict

pull/3/head
Jure Šorn 6 years ago
parent
commit
93e13d7f58
1 changed files with 11 additions and 4 deletions
  1. 15
      README.md

15
README.md

@ -55,10 +55,11 @@ Dictionary
``` ```
```python ```python
collections.defaultdict(<type>) # Creates a dictionary with default values of type.
collections.OrderedDict() # Creates ordered dictionary.
dict(<list>) # Initiates a dict from list of key/value pairs.
dict(zip(keys, values)) # Initiates a dict from two lists.
collections.defaultdict(<type>) # Creates a dictionary with default value of type.
collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1.
collections.OrderedDict() # Creates ordered dictionary.
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. {k: v for k, v in <dict>.items() if k in <list>} # Filters a dict by keys.
``` ```
@ -641,6 +642,12 @@ while True:
break break
``` ```
### Recursion Limit
```python
>>> sys.getrecursionlimit()
1000
>>> sys.setrecursionlimit(10000)
```
JSON JSON
---- ----

Loading…
Cancel
Save