items()

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.

..................Content has been hidden....................

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