***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Tuesday, June 15, 2021

Dictionary Methods

Dictionary objects have several methods,
which are summarized in below Table.


Syntax of above methods:



1. dictionary.clear()



2. dictionary.get(key,
default)



In the general format, dictionary is
the name of a dictionary, key is a key to search for in the dictionary,
and default is a default value to return if the key is not found.



3. dictionary.items()



4. dictionary.keys()



5. dictionary.pop(key, default)



In the general format, dictionary is the name of a
dictionary, key is a key to
search for in the dictionary, and default
is a default value to return if the key is not found.



6. dictionary.popitem()



7. dictionary.values()

No comments:

Post a Comment