[Tutor] how to remove first '/'

Brett Wilkins lupin at orcon.net.nz
Wed Aug 26 08:16:29 CEST 2009


I would say the best way would be to use lstrip...
path='/path/to/file'
stripped_path = path.lstrip('/')

Cheers
--Brett

> Hello,
> I want to strip the first '/' from the following:
>
> '/path/to/file'
>
> How can I do this?
>
> Dave
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list