Matching a string up to a word

Dag dag at animagicnet.no
Wed Sep 4 08:11:35 EDT 2002


I have a string that contains an ID number a file path and a date, kind
of like this:

23545 /this/is a/path/to/a file Sun Sep 7 2002.

I want to extract the file name.  If I could be sure that the file path
had no spaces or if it would be quited it would be easy.  Unfortunatly 
many files will have spaces and changing the format of the output I'm
dealing with isn't possible.  I do however know that the file name starts 
after the first whitspace and that it's always followed by a three letter 
day name (like Mon, Tue etc.)  Given this is there an easy way to extract 
the whole file path from the string.

Dag




More information about the Python-list mailing list