import os
def findstrr(path, st):
for x in os.listdir(path):
if os.path.isdir(x):
new_path = os.path.join(path, x)
findstrr(new_path, st)
elif st in os.path.splitext(x)[0]:
print("相关文件名:%s, 相对路径: %s" % (x, os.path.relpath(path)))
if __name__ == '__main__':
f = os.path.abspath('.')
text = input('input: ')
findstrr(f, text)