python3 dictionary get code example
Example 1: how to get the value out of a dictionary python3
#!/usr/bin/python3
dict = {'Name': 'Zara', 'Age': 27}
print ("Value : %s" % dict.get('Age'))
print ("Value : %s" % dict.get('Sex', "NA"))
# Value : 27
# Value : NA
Example 2: py3 dict values
Yes it's the exact same thing in Python 2:
d.values()
In Python 3 (where dict.values returns a view of the dictionary’s values instead):
list(d.values())