Getting a list of values from a list of dict in python: Without using list comprehension
Question: I have a list of dict for example,

    
    
    [{'id': 1L, 'name': u'Library'}, {'id': 2L, 'name': u'Arts'}, {'id': 3L, 'name':  u'Sports'}]
    

Now, I have to retrieve the following list from this dict without using list
comprehension

    
    
    [u'Library', u'Arts', u'Sports']
    

Is there any way to achieve this in python? I saw many similar questions, but
all answers were using list comprehension.

Any suggestion is appreciated. Thanks in advance.


Answer: You could use `itemgetter`:

    
    
    from operator import itemgetter
    
    categories = map(itemgetter('name'), things)
    

But a list comprehension is good too. What's wrong with list comprehensions?

