import shutil shutil.rmtree(dir) 另外: os.path.exists() 判断目录是否存在 转载于:https://www.cnblogs.com/findeasy/archive/2013/01/01/4053133.html