擅长:python、mysql、java
<pre><code>params = {'descending': 'true', 'startkey': 'Mexico', 'endkey': 'Mexico'}
pairs = ['{}="{}"'.format(k,v) for k,v in params.items()]
print '&'.join(pairs);
output:
startkey="Mexico"&endkey="Mexico"&descending="true"
</code></pre>
<p>如果你不想让true被引用,那么在for循环中做同样的事情,不要引用true。在</p>
<p>查询字符串中不允许使用双引号,因此最好使用:</p>
^{pr2}$