Thanks this is much more simple and is what i need. On Sun, Feb 15, 2009 at 9:29 PM, Lie Ryan <lie.1...@gmail.com> wrote:
> On Sun, 15 Feb 2009 14:22:09 +0100, Andre Engels wrote: > > What is 'new' in your solution? Apart from that, the following looks > > simpler: > > > >>>> url = "http://this/is/my/url/to/parse" parts = url.split('/') > >>>> sol = '/'.join(parts[:-1]) > >>>> sol > > 'http://this/is/my/url/to' > > do you want something even more simpler? > > >>> url ="http://this/is/my/url/to/parse" > >>> url.rsplit('/', 1)[0] > 'http://this/is/my/url/to' > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor