Привет vegetax! 03 марта 2005 в 13:54, vegetax в своем письме к All писал:
v> I need this in order to print a directory tree with htmlgen library v> which uses nested lists to represent trees. As you see from output of your code, you simply add items to the only list. Try this: v> def rec(f): res=[] v> print f v> for ele in listdir(f): v> ele=join(f,ele) v> if isdir(ele): v> # append the directory name v> res.append(basename(ele)) res+=[ rec(ele) ] v> else: v> res.append(basename(ele)) return res print rec(dirpath) Alexander, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list