import os
def get_files(path):
fs=[]
for root, dirs, files in os.walk(path):
for file in files:
fs.append(os.path.join(root,file))
return fs
bip_table_name=['a23csd_file1','a23ff_file2']
bip=['.'+i+'.txt' for i in bip_table_name]
for i in bip:
for j in get_files('新建文件夹'):
if i in j:
print(j)
a=open(j,'r').read()
with open('new.txt','a+') as f:
f.write(a)
f.write(';\n')
f.write('---------------------------\n')
pytho查找符合条件的文件
最新推荐文章于 2022-10-04 20:51:19 发布