function nested

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu May 24 06:08:37 EDT 2007


Gigs_ a écrit :
> 
> i have this function.
> 
> def f(start):
>     stack = []
>     def f1(start):
>         for fname in os.listdir(startDir):
>            path = os.path.join(startDir, fname)
>            if os.path.isfile(path):
>                stack.append(path)
>            else:
>                f1(path)
>     return stack
> 
> 
> this is returning empty list, why?

Because that's what you are returning. Perhaps did you mean to actually 
*call* f1() after defining it ?-)



More information about the Python-list mailing list