def subfolders(path):
 folders = []
 while (path not in ('/', '')):
  folders.append(path)
  path = os.path.dirname(path)
 folders.reverse()
 return folders

def subfolders ( path ) : folders = [ ] while ( path not in ( '/' , '' ) ) : folders . append ( path ) path = os . path . dirname ( path ) folders . reverse ( ) return folders
decompose a path string into a list of subfolders eg convert apps/dashboard/ranges into [apps .