On 2016-01-12 13:46, Peter Otten wrote:
> Tim Chase wrote:
> > >>> u = urlparse.urlsplit(URL)
> > >>> lst = list(u) # can't manipulate the tuple directly
> > >>> lst[3] = "bar=baz" # 3 = query-string index
> > >>> urlparse.urlunsplit(lst)
> > 'http://foo/path1/path2/?bar=baz'
> >
> > It
Tim Chase wrote:
> I can successfully parse my URLs. However, I'd like to modify a part
> then reassemble them. However, like tuples, the parts appear to be
> unmodifiable
>
> >>> URL = 'http://foo/path1/path2/?fragment=foo'
> >>> import urlparse
> >>> u = urlparse.urlparse(URL)
> >>> u
I can successfully parse my URLs. However, I'd like to modify a part
then reassemble them. However, like tuples, the parts appear to be
unmodifiable
>>> URL = 'http://foo/path1/path2/?fragment=foo'
>>> import urlparse
>>> u = urlparse.urlparse(URL)
>>> u
ParseResult(scheme='http', ne