Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Accessing elements from a Python Dictionary using the get method

# welcome to softhunt.net
# Python program to demonstrate
# accessing a element from a Dictionary

# Creating a Dictionary
Dictionary = {0: 'Softhunt', 1: '.net', 2: 'By Ranjeet', 'user': 'Greetings to you'}
print("Dictionary", Dictionary)

# accessing a element using get()
# method
print("Accessing a element using get:", Dictionary.get('user'))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Accessing #elements #Python #Dictionary #method
ADD COMMENT
Topic
Name
3+3 =