Sometimes, we want to change a Django QueryDict to a Python Dict.
In this article, we’ll look at how to change a Django QueryDict to a Python Dict.
How to change a Django QueryDict to a Python Dict?
To change a Django QueryDict to a Python Dict, we cann the dict
method on the query dict.
For instance, we write
q = QueryDict('a=1&a=3&a=5')
d = q.dict()
to create the query dict q
.
Then we call q.dict
to return the query dict data as a dict.
Conclusion
To change a Django QueryDict to a Python Dict, we cann the dict
method on the query dict.