May-31-2021, 11:14 PM
Greeting!
I have to scan directories and find/process subdirectories.
Number of SubDirs not static.
I thought I could use a function but found I cannot "return" all the SubDirs.
I can print all of them but not return them.
I'm sure it is simple but I could not find a clear answer but I cannot find one.
I have to scan directories and find/process subdirectories.
Number of SubDirs not static.
I thought I could use a function but found I cannot "return" all the SubDirs.
I can print all of them but not return them.
I'm sure it is simple but I could not find a clear answer but I cannot find one.
def func(dir1):
for ed1 in os.listdir(dir1) :
echd_p = os.path.join(dir1,ed1)
if os.path.isdir(echd_p) :
return (echd_p)
fdp = func(dir1)
print(type(fdp))
print(fdp) Thank you.
