15 lines
475 B
Python
15 lines
475 B
Python
#!/usr/bin/python
|
|
# A directory example
|
|
|
|
dict = {'fName': 'Edward', 'lName': 'Bigos', 'Office': 617, 'Phone': '413-755-4544'}
|
|
|
|
|
|
try:
|
|
print("dict['fName'] dict['lName']: ", dict['fName']," ", dict['lName'])
|
|
print ("dict['Office']: ", dict['Office'])
|
|
print ("dict['Phone']: ", dict['Phone'])
|
|
print ("dict['Mobile']: ", dict['Mobile'])
|
|
except KeyError:
|
|
print("\nInvalid key selected.")
|
|
print("Sorry, there is no mobile phone number in the directory.")
|
|
print("\n")
|