Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Last active July 10, 2020 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/1f3720601dabaa0362bf6addd6267129 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/1f3720601dabaa0362bf6addd6267129 to your computer and use it in GitHub Desktop.
d={'name':'karthi',
'age':7,
'city':'chennai',
}
#get(accessing using get method)
print(d.get("name")) # Output: karthi
#If key doesn't exists in the dictionary means ,returns None
print (d.get('rollno')) # Output: None
#default is mentioned.
print (d.get('rollno',"Not Available"))#Output:Not Available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment