import os
str=input('请输入需要找的文件所包含的字符串:')
path=os.getcwd() #当前目录
for root,dirs,files in os.walk(path,topdown=True):
for name in dirs:
#print(os.path.join(path,name))
if not name.find(str)==-1:
print(os.path.join(path,name))
for name in files:
#print('\t',os.path.join(path,name))
Sign in to make a reply
无所谓ovo
import os
str=input('请输入需要找的文件所包含的字符串:')
path=os.getcwd() #当前目录
for root,dirs,files in os.walk(path,topdown=True):
for name in dirs:
#print(os.path.join(path,name))
if not name.find(str)==-1:
print(os.path.join(path,name))
for name in files:
#print('\t',os.path.join(path,name))
if not name.find(str)==-1:
print(os.path.join(path,name))