circuitpython/tests/basics/dict_pop.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
237 B
Python
Raw Normal View History

2014-01-06 14:48:34 -05:00
d = {1: 2, 3: 4}
print(d.pop(3), d)
print(d)
print(d.pop(1, 42), d)
print(d.pop(1, 42), d)
print(d.pop(1, None), d)
try:
print(d.pop(1), "!!!")
2014-01-06 14:48:34 -05:00
except KeyError:
print("Raised KeyError")
else:
print("Did not raise KeyError!")