mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
add dict.items() (#2290)
This commit is contained in:
parent
7895dcc604
commit
912d546dc7
@ -301,6 +301,9 @@ filled_dict.keys() # => ["three", "two", "one"]
|
||||
filled_dict.values() # => [3, 2, 1]
|
||||
# Note - Same as above regarding key ordering.
|
||||
|
||||
# Get all key-value pairs as a list of tuples with "items()"
|
||||
filled_dicts.items() # => [("one", 1), ("two", 2), ("three", 3)]
|
||||
|
||||
# Check for existence of keys in a dictionary with "in"
|
||||
"one" in filled_dict # => True
|
||||
1 in filled_dict # => False
|
||||
|
Loading…
Reference in New Issue
Block a user