1. 首页
  2. 数据库
  3. 其它
  4. python删除某个目录文件夹的方法

python删除某个目录文件夹的方法

上传者: 2020-12-22 10:33:37上传 PDF文件 36.76KB 热度 28次
python删除某个目录文件夹及文件的方法: #!/usr/bin/env python import os import shutil delList = [] delDir = "/home/test" delList = os.listdir(delDir ) for f in delList: filePath = os.path.join( delDir, f ) if os.path.isfile(filePath): os.remove(filePath) print filePath + " was removed!" elif os.path.
下载地址
用户评论