values
Builtin index · Collections & strings
result = keys(d)
Input: d · Output: result
What it is
d is a Dict.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = keys(d) | d Dictnot documented yet | result List | Returns a List: its keys (keys), its values (values), or (key, value) tuples (items) — insertion order, not sorted. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
d = dict(["a", "b"], [1, 2])
d = set(d, "c", 3)
print(get(d, "b")) # 2
print(keys(d)) # ("a", "b", "c")
print(values(d)) # (1, 2, 3)
print(items(d)) # (("a", 1), ("b", 2), ("c", 3))
print(has_key(d, "c")) # true
print(has_key(d, "z")) # false
output
2
("a", "b", "c")
(1, 2, 3)
(("a", 1), ("b", 2), ("c", 3))
true
falsefrom collections-strings