deleting file the previous section of this "updating file content,explains how to adddeleteand update records in file howeverat some point you may need to delete the file the following steps describe how to delete files that you no longer need this example also appears with the downloadable source code as deletecsv py open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each lineimport os os remove("changedfile csv"print("file removed!"the task looks simple in this caseand it is all you need to do to remove file is call os remove(with the appropriate filename and path (as neededpython defaults to the current directoryso you don' need to specify path if the file you want to remove is in the default directorythe ease with which you can perform this task is almost scary because it' too easy putting safeguards in place is always good idea you may want to remove other itemsso here are other functions you should know aboutos rmdir()removes the specified directory the directory must be empty or python will display an exception message shutil rmtree()removes the specified directoryall subdirectoriesand all files this function is especially dangerous because it removes everything without checking (python assumes that you know what you're doingas resultyou can easily lose data using this function choose runrun module the application displays the file removedmessage when you look in the directory that originally contained the changedfile csv fileyou see that the file is gone