from make_db_file import loaddbasestoredbase db loaddbase(db['sue']['pay'* db['tom']['name''tom tomstoredbase(dbhere are the dump script and the update script in action at system command lineboth sue' pay and tom' name change between script runs the main point to notice is that the data stays around after each script exits--our objects have become persistent simply because they are mapped to and from text files\pp \previewpython dump_db_file py bob ={'pay' 'job''dev''age' 'name''bob smith'sue ={'pay' 'job''hdw''age' 'name''sue jones'tom ={'pay' 'job'none'age' 'name''tom'sue jones \pp \previewpython update_db_file py \pp \previewpython dump_db_file py bob ={'pay' 'job''dev''age' 'name''bob smith'sue ={'pay' 'job''hdw''age' 'name''sue jones'tom ={'pay' 'job'none'age' 'name''tom tom'sue jones as iswe'll have to write python code in scripts or at the interactive command line for each specific database update we need to perform (later in this we'll do better by providing generalized consoleguiand web-based interfaces insteadbut at basic levelour text file is database of records as we'll learn in the next sectionthoughit turns out that we've just done lot of pointless work using pickle files the formatted text file scheme of the prior section worksbut it has some major limitations for one thingit has to read the entire database from the file just to fetch one recordand it must write the entire database back to the file after each set of updates although storing one record' text per file would work around this limitationit would also complicate the program further for another thingthe text file approach assumes that the data separators it writes out to the file will not appear in the data to be storedif the characters =happen to appear in the datafor examplethe scheme will fail we might work around this by generating xml text to represent records in the text fileusing python' xml parsing toolswhich we'll meet later in this textto reloadxml tags would avoid collisions with actual step storing records persistently