Python Dictionary get() Method

0

Python Dictionary get() Method

  • The get() method returns the value for the specified key if key is in dictionary.

Syntax

  • dictionary.get(keyname, value) 

Parameter Values

The get() method takes maximum of two parameters:

  • key - key to be searched in the dictionary
  • value (optional) - Value to be returned if the key is not found. The default value is None.


 

 

 

 

Post a Comment

0Comments
Post a Comment (0)