def find(s,name):
dir=[x for x in os.listdir(s) if os.path.isdir(os.path.join(s,x))]
file=[x for x in os.listdir(s) if os.path.isfile(os.path.join(s,x)) and name in os.path.splitext(x)[0]]
for x in file:
print(x)
for x in dir:
find(os.path.join(s,x),name)
Sign in to make a reply
画手
def find(s,name):
dir=[x for x in os.listdir(s) if os.path.isdir(os.path.join(s,x))]
file=[x for x in os.listdir(s) if os.path.isfile(os.path.join(s,x)) and name in os.path.splitext(x)[0]]
for x in file:
print(x)
for x in dir:
find(os.path.join(s,x),name)