import os
def func(x,y):
for i in os.listdir(x):
join=os.path.join(x,y)
if os.path.isfile(i) and y in i
print join
elif os.path.isdir(join):
#elif os.path.isdir(i):
return func(join,y)
x='/python'
y='find'
func(x,y)
import os
def func(x,y):
for i in os.listdir(x):
join=os.path.join(x,y)
if os.path.isfile(i) and y in i
print join
elif os.path.isdir(join):
#elif os.path.isdir(i):
return func(join,y)
x='/python'
y='find'
func(x,y)
转载于:https://my.oschina.net/u/2562304/blog/550223