May 2017
Intermediate to advanced
280 pages
6h 2m
English
The syntax of the items() method is as follows:
dict.items()
The items() method returns the list of dictionary's (key, value) tuple pairs:
>>> dict1 = d={1:'one',2:'two',3:'three'} >>> dict1.items() [(1, 'one'), (2, 'two'), (3, 'three')] >>>
Sometimes, we need to delete all the items of a dictionary. This can be done by using the clear() method.
Read now
Unlock full access