micropython/tests/basics/dict_specialmeth.py

8 lines
123 B
Python
Raw Normal View History

# dict object with special methods
d = {}
d.__setitem__('2', 'two')
print(d.__getitem__('2'))
d.__delitem__('2')
print(d)