summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevin Soni <devinsoni1010@gmail.com>2016-06-26 08:30:39 -0400
committerven <vendethiel@hotmail.fr>2016-06-26 14:30:39 +0200
commit912d546dc7e6c83cbac4800aff6116dd77101b5d (patch)
tree78a7d90b0887580f57e8ccb07acbe68738c59938
parent7895dcc6043d9229b593516ebf17cca08a515227 (diff)
add dict.items() (#2290)
-rw-r--r--python.html.markdown3
1 files changed, 3 insertions, 0 deletions
diff --git a/python.html.markdown b/python.html.markdown
index fa604455..2105748c 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -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