import os
n = 0
for root, dirs, files in os.walk('./rar/data'): #指定目录
for name in files:
if(name == 'test.txt'): #指定文件名
n += 1
print(n)
os.remove(os.path.join(root, name))
import os
n = 0
for root, dirs, files in os.walk('./rar/data'): #指定目录
for name in files:
if(name == 'test.txt'): #指定文件名
n += 1
print(n)
os.remove(os.path.join(root, name))
发表评论 取消回复