Mercurial > hg > config
changeset 386:bea5f2fe4ea4
it works even more!
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 26 Jul 2013 14:58:18 -0700 |
parents | 6ef0ea2f10e3 |
children | 0aee0da6b06b |
files | python/tree2.py |
diffstat | 1 files changed, 3 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/python/tree2.py Fri Jul 26 13:14:19 2013 -0700 +++ b/python/tree2.py Fri Jul 26 14:58:18 2013 -0700 @@ -27,13 +27,13 @@ break return level -def tree(directory): +def tree(directory, sort_key=lambda x: x.lower()): - sort_key=lambda x: x.lower() retval = [] - top = depth(directory) indent = [] last = {} + top = depth(directory) + for dirpath, dirnames, filenames in os.walk(directory, topdown=True): abspath = os.path.abspath(dirpath) @@ -68,11 +68,6 @@ else: dirpath_mark = ITEM - - # if basename == 'bin': - # import pdb; pdb.set_trace() - - str_indent = ''.join(indent) retval.append('%s%s%s'% (''.join(indent[:-1]), dirpath_mark, basename)) if filenames: last_file = filenames[-1]