how can i delete a folder using python script?and what are the return values??
+5
A:
If you want to delete a folder that's empty use os.rmdir:
import os
os.rmdir('/mypath')
If you want to delete a folder that's not empty use shutil.rmtree:
import shutil
shutil.rmtree('/mypath')
Brian R. Bondy
2010-04-08 04:06:11
A:
you can use os.rmdir()
to remove a directory. To remove a directory tree recursively, you can use shutil.rmtree
. If you know that you already have empty directory nodes, you can also check out os.removedirs()
ghostdog74
2010-04-08 04:13:30