import os
relist = []
def allfile(setdir="."):
for x in os.listdir(setdir):
if os.path.isdir(x):
allfile(x)
else:
relist.append(x.lower())
return relist
def searchfile(key="", setdir="."):
for x in allfile(setdir):
if(key.lower() in x):
return x
key = input("请输入你要查找的文件名:")
print("文件列表:",allfile())
print(searchfile(key, setdir="."))
我有一只小鸭蛋
发现自己写好多 = =# 也算能用吧