record db[keyupdate existing record elseor make/store new rec record person(name='?'age='?'evalquote strings for field in fieldnamescurrval getattr(recordfieldnewtext input('\ [% ]=% \ \ \tnew?=>(fieldcurrval)if newtextsetattr(recordfieldeval(newtext)db[keyrecord db close(notice the use of eval in this script to convert inputs (as usualthat allows any python object typebut it means you must quote string inputs explicitlyand the use of setattr call to assign an attribute given its name string when runthis script allows any number of records to be added and changedto keep the current value of record' fieldpress the enter key when prompted for new valuekey=tom [name]=tom doe new?=[age]= new?=> [job]=none new?=>'mgr[pay]= new?=> key=nobody [name]=new?=>'john doh[age]=new?=> [job]=none new?=[pay]= new?=>none key=this script is still fairly simplistic ( errors aren' handled)but using it is much easier than manually opening and modifying the shelve at the python interactive promptespecially for nonprogrammers run the query script to check your work after an update (we could combine query and update into single script if this becomes too cumbersomealbeit at some cost in code and user-experience complexity)key=tom name =tom doe age = job =mgr pay = key=nobody name =john doh step adding console interaction