RE Despair - help required

Yoav yoav_artzi at il.vio.com
Thu Aug 25 10:03:56 EDT 2005


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"



Fredrik Lundh wrote:
> "Yoav" wrote:
> 
>>I am trying the following:
>>
>>re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")
>>
>>and I get a return of NoneType, and I have no idea why. I know that I
>>missing something here, but I really can't figure out why
> 
> 
> instead of struggling with weird REs, why not use Python's standard
> filename manipulation library instead?
> 
>     http://docs.python.org/lib/module-os.path.html
> 
> </F> 
> 
> 
> 



More information about the Python-list mailing list