def list_recursively(dir):
 if (not _os.path.isdir(dir)):
  raise ValueError, ('%s is not a directory.' % dir)
 for f in _os.listdir(dir):
  if _os.path.isdir(f):
   list_recursively(f)
  else:
   (yield f)

def list_recursively ( dir ) : if ( not _os . path . isdir ( dir ) ) : raise ValueError , ( '%s is not a directory.' % dir ) for f in _os . listdir ( dir ) : if _os . path . isdir ( f ) : list_recursively ( f ) else : ( yield f )
recursively list the contents of a directory .