text: MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
  #!/usr/bin/env python import os import sys print os.chdir(sys.argv[1]) leafdirs = [] for dirpath, dirnames, filenames in os.walk('.'): if len(dirnames) == 0: leafdirs.append(dirpath) print "leafdirs",leafdirs
  import os import sys def treat_leafdir_files(topdir): for dirpath, dirnames, filenames in os.walk(topdir): if len(dirnames) == 0: for filename in filenames: fullpath = os.path.join(dirpath, filename) print "do something with", fullpath mydir = sys.argv[1] # for testing from the command line treat_leafdir_files(mydir)
  if len(dirnames) == 0:
  on the other hand is easier to understand for people who aren't that used to Python
  >>> import this
  The Zen of Python, by Tim Peters
  ...
  Explicit is better than implicit.
  ...
  Readability counts.
  If you are experiencing a similar issue, please ask a related question
  Join the community of 500,000 technology professionals and ask your questions.