"mjakowlew"wrote:
> filepath='c:\documents\web\zope\file.ext'
>
> I need to extract everthing after the last '\' and save it.
that string doesn't contain what you think it does:
>>> filepath='c:\documents\web\zope\file.ext'
>>> filepath
'c:\\documents\\web\\zope\x0cile.ext'
>>> print filepath
c:\documents\web\zope?ile.ext
if you fix that, you can use os.path.basename() to strip off the last
part:
>>> filepath=r'c:\documents\web\zope\file.ext'
>>> filepath
'c:\\documents\\web\\zope\\file.ext'
>>> print filepath
c:\documents\web\zope\file.ext
>>> import os
>>> os.path.basename(filepath)
'file.ext'
for more info on Python's string literal syntax, see section 3.1.2 in the
Python Tutorial, and this page:
http://docs.python.org/ref/strings.html
</F>
--
http://mail.python.org/mailman/listinfo/python-list