On Tue, Aug 25, 2009 at 3:55 PM, <davidwil...@safe-mail.net> wrote: > Hello, > I want to strip the first '/' from the following: > > '/path/to/file' > > How can I do this? > > Dave > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >
there are many ways to do this, heres a few: x = "/path/to/file" print x.partition("/")[-1] print x[1:] print "/".join(x.split("/")[1:])
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor