Skip to content

Commit ef1e46a

Browse files
committed
Dict
1 parent ae481ed commit ef1e46a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ Dictionary
5858
<view> = <dict>.keys()
5959
<view> = <dict>.values()
6060
<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.
6361
<dict>.update(<dict>)
6462
```
6563

6664
```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.
6969
```
7070

7171
```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.
7474
{k: v for k, v in <dict>.items() if k in <list>} # Filters a dict by keys.
7575
```
7676

0 commit comments

Comments
 (0)