it might work just to strip 'home' and leave

print s1
//test/

the '/' character is a separator, so
/this//that/andmore/
is, at least at the shell level, the same as
/this/that/andmore/
i.e. any number of '/' characters adjacent has
the effect of a single '/' character (again, at the
shell level).

On Nov 30, 2007, at 9:17 AM, Tim Johnson wrote:

> Hello:
> I'm seeing some strange behavior with lstrip operating
> on string representations of *nix-style file paths
> Example:
>>>> s = '/home/test/'
>>>> s1 = s.lstrip('/home')
>>>> s1
> 'test/'   ## '/test/' was expected! '/' was unexpectedly removed
> Any comments or corrective measures are welcome
> thanks
> Tim
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to