简体   繁体   中英

How to get all values with the same key in an immut. dict?

ImmutableMultiDict([('course', u'2132'), ('course', u'2121'), 
('myc', u''), ('ok', u'Add to my plan')])

is the dict I get in my WSGI-Code written in Python.

Now I want to get all entries with the course key, but args.get("course") only returns the first value of 2132 .

You can use getlist method, like this

immutable_dict_obj.getlist("course")

This will return a list of values corresponding to the key course .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM