import os path = './louvain1.0/' for i in os.listdir(path): path_file = os.path.join(path,i) if os.path.isfile(path_file): os.remove(path_file) else: for f in os.listdir(path_file): path_file2 =os.path.join(path_file,f) if os.path.isfile(path_file2): os.remove(path_file2) # 这个地方只能删去一层 # 也就是说删除louvain1.0/a.txt # 或者louvain1.0/picture/2.txt这种文件
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)