Python Dictionary get() Method


Python Dictionary get() Method

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


  • 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

Post a Comment (0)