简体   繁体   中英

Python urlencode with double quotes

I have a dict like this:

d = {'orderBy': 'XXXXX'}

When I call urlencode (), it transforms into:

orderBy = XXXXX

But I needed it to look like this:

orderBy = "XXXXX"

Does anyone know how I add these two quotes using urllib? Thank you!

Just set your dict with the doble quotes:

>>> d = { 'orderBy': '"XXXXX"' }
>>> urlencode(d)
'orderBy="XXXXX"'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM