[Zope] Cleaning Filenames from Windows

Terry Hancock hancock at anansispaceworks.com
Fri Sep 19 20:33:32 EDT 2003


On Friday 19 September 2003 05:16 pm, Edward Pollard wrote:
> On Friday, September 19, 2003, at 04:03 PM, Edward Pollard wrote:
> 
> > Can anyone give me a hand?
> 
> It's *always* right when you give up, when you ask people for a hand, 
> that Google returns what you need. I think it's a "Make idiots look 
> foolish" feature. They should turn that off.
> 
> For the sake of completeness:
> filename[max(string.rfind(filename, '/'),string.rfind(filename, 
> '\\'),string.rfind(filename, ':'),)+1:]

Sheesh, wouldn't

str(filename).split('\\')[-1]

be easier?  Or does that miss some case?

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com



More information about the Zope mailing list