Access Values in Dictionaries
To access dictionary elements, you use the familiar square brackets along with the key to obtain its value:
Example
>>> dict2 = {'name':'earth','port':80} >>> dict2 {'name': 'earth', 'port': 80} >>> dict2['name'] 'earth' >>> dict2['port'] 80 >>> dict2.has_key('name') True >>> dict2.keys() ['name', 'port'] >>> dict2.values() ['earth', 80]