PEP 222 draft

Michael Ströder michael at stroeder.com
Thu Dec 28 06:06:10 EST 2000


tlownds at my-deja.com wrote:
> 
> In article <slrn947bj1.1rs.amk at 207-172-57-45.s45.tnt2.ann.va.dialup.rcn.com>,
>   akuchlin at mems-exchange.org wrote:
> >     Utility function: build a query string from a list of 2-tuples
> >
> 
> Perhaps it would be better to extend urllib.urlencode to handle this 
> case. I think it should be extended to handle lists as values as well:
> 
> >>> urlencode({'x': ['a', 'b']})
> 'x=%5b%27a%27,+%27b%27%5d'
> 
> would be:
> 
> 'x=a&x=b'

But you can do that with a list of 2-tuples either. Note: The list
order of dictionary keys is normally not preserved.

Ciao, Michael.



More information about the Python-list mailing list