if not os path isfile("testfile csv")print("please run the createfile py example!"quit(newdata formatdata readdata("testfile csv"for entry in newdataprint(entryprint("\ \nadding record for harry "newrecord "'harry' falsenewdata append(newrecordfor entry in newdataprint(entryprint("\ \nremoving doug' record "location newdata index("'doug' true"record newdata[locationnewdata remove(recordfor entry in newdataprint(entryprint("\ \nmodifying sally' record "location newdata index("'sally' false"record newdata[locationsplit record split(","newrecord formatdata(split[ replace("'""")int(split[ ])bool(split[ ])newrecord married true newrecord age newdata append(newrecord __str__()newdata remove(recordfor entry in newdataprint(entryformatdata savedata("changedfile csv"newdatathis example has quite bit going on firstit checks to ensure that the testfile csv file is actually present for processing this is check that you should always perform when you expect file to be present in this caseyou aren' creating new fileyou're updating an existing fileso the file must be present if the file isn' presentthe application ends the next step is to read the data into newdata this part of the process looks much like the data reading example earlier in the you have already seen code for using list functions in this example uses those functions to perform practical work the append(function adds new record to newdata howevernotice that the data is added as stringnot as formatdata object the data is stored as