def split_path(f):
 components = []
 (drive, path) = os.path.splitdrive(f)
 while True:
  (path, folder) = os.path.split(path)
  if folder:
   components.append(folder)
  else:
   if path:
    components.append(path)
   break
 if drive:
  components.append(drive)
 components.reverse()
 return components

def split_path ( f ) : components = [ ] ( drive , path ) = os . path . splitdrive ( f ) while True : ( path , folder ) = os . path . split ( path ) if folder : components . append ( folder ) else : if path : components . append ( path ) break if drive : components . append ( drive ) components . reverse ( ) return components
split a path into components .