Personal DB/Unclassified record
django - getlist
Ayin Kim
2021. 1. 1. 23:34
반응형
What is this?
QueryDict.getlist(key, default=None)¶
Returns a list of the data with the requested key. Returns an empty list if the key doesn’t exist and default is None. It’s guaranteed to return a list unless the default value provided isn’t a list.
e.g.
>>> q = QueryDict('a=1', mutable=True)
>>> q.update({'a': '2'})
>>> q.getlist('a') ['1', '2']
>>> q['a'] # returns the last '2'