Removing dictionary items

As for lists, to remove an entry from a dictionary, we use the del keyword:

>>> z = {'H': 1, 'Tc': 43, 'Xe': 54, 'Un': 137, 'Rf': 104, 'Fm': 100}
>>> del z['Un']
>>> z
{'H': 1, 'Fm': 100, 'Rf': 104, 'Xe': 54, 'Tc': 43}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset