python - how does QueryDict split HttpRequest query -


example:

>>> django.http import querydict >>> q = querydict('a=x&b=y&c=z') >>> q <querydict: {u'a': [u'x'], u'c': [u'z'], u'b': [u'y']}> >>> q = querydict('a=x&b=y&c=z+1') >>> q <querydict: {u'a': [u'x'], u'c': [u'z 1'], u'b': [u'y']}> >>>                                  ^ 

why '+' replaced space?

+ reserved shorthand notation space.

to represent +, use %2b:

>>> querydict('a=x&b=y&c=z%2b1') <querydict: {u'a': [u'x'], u'c': [u'z+1'], u'b': [u'y']}> 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -