   Deleting Specific Lines in Python
  Is there any way to delete specific lines in file object, and also is there any way to delete entire files, not just clear their contents.  (in python.)  Thanks in advance.   
  As with any other programming language, the only way to delete part of a file is to read in the whole file and to write back the parts you want to keep. You cannot just excise part of the file and expect the rest to automatically pack up.That being said,foo = open("foo.txt").readlines()foo[5] = ""del foo[10:30]open("foo.txt","w").writelines(foo)May do something similar to what you want.As for removing files from the disk, you can use os.remove, os.rmdir, os.removedirs or shutil.rmtree, depending on your needs.   