Convert Querydict To Key-value Pair Dictionary
I have a QueryDict that I get from request.POST in this format:
Solution 1:
You can use list comprehension to get the first entry from the value lists;
dd = dict(request.POST)
ddnew = {k:dd[k][0] for k in dd}
Post a Comment for "Convert Querydict To Key-value Pair Dictionary"