dealing with paths, multiple OS versions, cgi's
Skip Montanaro
skip at pobox.com
Mon Mar 18 16:07:06 EST 2002
Glenn> What I need is some method for stripping off the basename
Glenn> regardless of the browser OS.
How about something like:
>>> import re
>>> re.sub(r".*[\\/:]", "", r"c:\temp\file.doc")
'file.doc'
>>> re.sub(r".*[\\/:]", "", r"/home/user/file.doc")
'file.doc'
(":" should catch mac paths I think.)
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list