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