splitting string

Zunbeltz Izaola zunbeltz at wm.lc.ehu.es.XXX
Thu Jul 8 05:01:39 EDT 2004


"Laura McCord" <Laura.McCord at doucet-austin.com> writes:

> I want to split a filename string such as Y:\folder\directory\file 
> 
> it is stored like this in my python code:
>  fname = self.filename
> 
> How can I get rid of everything before the word 'file'?
> 
> I had tried something like this:
>  fname = self.filename
>  s = fname.split("\")
>  fname = s[-1]
> 
> Any suggestions?
>

Try the os.path module

Zunbeltz
 
> Thanks
> 
>  

-- 
Zunbeltz Izaola Azkona                    |  wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila      |
Zientzia eta Teknologia Fakultatea        |  Phone: 34946015326
Euskal Herriko Unibertsitatea             |   
PK 644                                    |  Fax:   34 944648500
48080 Bilbo (SPAIN)                       |



More information about the Python-list mailing list