import sys, shelvedef store_person(db): pid = raw_input('Enter unique ID number: ') person = {} person['name'] = raw_input('Enter name: ') person['age'] = raw_input('Enter age: ') person['phone'] = raw_input('Enter phone number: ') db[pid] = persondef lookup_person(db): pid = raw_input('Enter ID number: ') field = raw_input('What would you like to know? (name, age, phone) ') field = field.strip().lower() print field.capitalize() + ':', db[pid][field]def enter_command(): cmd = raw_input('Enter command (? for help): ') cmd = cmd.strip().lower() return cmddatabase = shelve.open('c:\database.dat')store_person(database)lookup_person(database)database.close()
Name (required)
email (will not be published) (required)
Website