File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -58,19 +58,19 @@ Dictionary
58
58
< view> = < dict > .keys()
59
59
< view> = < dict > .values()
60
60
< view> = < dict > .items()
61
- < value> = < dict > .get(key, default) # Returns default if key does not exist.
62
- < value> = < dict > .setdefault(key, default) # Same, but also adds default to dict.
63
61
< dict > .update(< dict > )
64
62
```
65
63
66
64
``` python
67
- collections.defaultdict(< type > ) # Creates a dictionary with default value of type.
68
- collections.defaultdict(lambda : 1 ) # Creates a dictionary with default value 1.
65
+ value = < dict > .get(key, default) # Returns default if key does not exist.
66
+ value = < dict > .setdefault(key, default) # Same, but also adds default to dict.
67
+ < dict > = collections.defaultdict(< type > ) # Creates a dictionary with default value of type.
68
+ < dict > = collections.defaultdict(lambda : 1 ) # Creates a dictionary with default value 1.
69
69
```
70
70
71
71
``` python
72
- dict (< list > ) # Initiates a dict from list of key-value pairs.
73
- dict (zip (keys, values)) # Initiates a dict from two lists.
72
+ dict (< list > ) # Initiates a dict from list of key-value pairs.
73
+ dict (zip (keys, values)) # Initiates a dict from two lists.
74
74
{k: v for k, v in < dict > .items() if k in < list > } # Filters a dict by keys.
75
75
```
76
76
You can’t perform that action at this time.
0 commit comments