On Sun, Feb 15, 2009 at 1:37 PM, Emad Nawfal (عماد نوفل) <emadnaw...@gmail.com> wrote:
> I'm not sure this is the best strategy, but it seems to work: > >>>> url ="http://this/is/my/url/to/parse" >>>> m = url.replace("//", '/').split("/") >>>> n = m[0]+"//"+"/".join(new[1:]) >>>> n > 'http://this/is/my/url/to' 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' -- André Engels, andreeng...@gmail.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor