Updating index.md (#20547)
Describing how to get just values from a dictionary in Python 3.x
This commit is contained in:
committed by
Christopher McCormack
parent
17ffd5a721
commit
ae31e8f007
@ -112,3 +112,13 @@ Use **`items()`** for Python 3.x:
|
|||||||
y 2
|
y 2
|
||||||
z 3
|
z 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To loop over just the values in the dictionary, do this in Python 3.x:
|
||||||
|
```python
|
||||||
|
>>> for value in d.values():
|
||||||
|
... print(value)
|
||||||
|
...
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user