RE Despair - help required

Robert Kern rkern at ucsd.edu
Thu Aug 25 10:21:07 EDT 2005


Yoav wrote:
> Don't think it will do much good. I need to get them from  a file and 
> extract the last folder in the path. For example:
> if I get "c:\dos\util"
> I want to extract the string "\util"

You mean like this:

import os
os.path.sep + os.path.split(r"c:\dos\util")[-1]

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list