开发者

easy way to change a dict data to url Parameter

开发者 https://www.devze.com 2023-01-02 21:58 出处:网络
(1) a={\'b\':\'bbbb\',\'c\':\'ccc\',....} (2) self.redirect(\'/tribes/view?b=\' + a[\'b\'] + \'&c=\' + a[\'c\'])

(1)

a={'b':'bbbb','c':'ccc',....}

(2)

self.redirect('/tribes/view?b=' + a['b'] + '&c=' + a['c'])

so i want to get

b=' + a['b'] + '&c=' + a['c'] ...

from dict a

开发者_JS百科

hae any easy way to do this ?

thanks


from urllib import urlencode
urlencode({'b':'bbbb', 'c':'ccc'})
0

精彩评论

暂无评论...
验证码 换一张
取 消