django - I have two values in a Tuple like ('Type', 'RES') can i assign like Type=RES and store it in dict? -



django - I have two values in a Tuple like ('Type', 'RES') can i assign like Type=RES and store it in dict? -

(u'type', u'res') (u'customerid', u'1110566212417')

is there way assign type = res , store in collection

you can utilize dict constructor (it takes list of tuples , makes dict):

pairs = [ (u'type', u'res'), (u'customerid', u'1110566212417') ] collection = dict(pairs) in [1]: collection out[1]: {u'customerid': u'1110566212417', u'type': u'res'}

django python-2.7 django-rest-framework

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -