def searchfile(path,k):
import os
filelist=os.listdir(path)
for x in filelist:
if k in x:
print(os.path.join(path,x))#这边是把x添加到路径后面,不能直接打印x
path= input('Directory: ')
k= input('search: ')
import os
filelist=os.listdir(path)
for x in filelist:
if k in x:
print(os.path.join(path,x))#这边是把x添加到路径后面,不能直接打印x
path= input('Directory: ')
k= input('search: ')
searchfile(path,k)
验证正确
^
表示行的开头,^\d<