convert ruby hash to URL query string … without those square brackets

后端 未结 5 1884
遇见更好的自我
遇见更好的自我 2021-02-13 16:46

In Python, I can do this:

>>> import urlparse, urllib
>>> q = urlparse.parse_qsl(\"a=b&a=c&d=e\")
>>> urllib.urlencode(q)
\'a=         


        
5条回答
  •  萌比男神i
    2021-02-13 17:49

    The way rails handles query strings of that type means you have to roll your own solution, as you have. It is somewhat unfortunate if you're dealing with non-rails apps, but makes sense if you're passing information to and from rails apps.

提交回复
热议问题