url.encore/quote

ianitux ianklaric at gmail.com
Thu Jun 26 12:14:17 EDT 2008


On 26 jun, 12:53, zowtar <zow... at gmail.com> wrote:
> urlencode({'page': i, 'order': 'desc', 'style': 'flex power'})
> return:
> page=1&order=desc&style=flex+power
>
> but I want:
> page=1&order=desc&style=flex%20power
>
> and url.quote don't put the &'s and ='s
> any idea guys?

Hi, a quick solution can be this one, or maybe you can do something
similar

>>> import string, urllib
>>> a = urllib.urlencode({'page': 'i', 'order': 'desc', 'style': 'flex power'})
>>> a.replace('+','%20')
'style=flex%20power&page=i&order=desc'



More information about the Python-list mailing list