On Tue, Jan 12, 2010 at 11:45 PM, Nico Grubert <nicogrub...@gmail.com> wrote:
> Hi there
>
> I have the following list 'mylist' that contains some dictionaries:
>
> mylist = [{'title':'the Fog', 'id':1},
>          {'title':'The Storm', 'id':2},
>          {'title':'the bible', 'id':3},
>          {'title':'The thunder', 'id':4}
>         ]

mylist.sort(key = lambda d: d['title'])

Use operator.itemgetter() to optimize in the unlikely event it becomes
necessary.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to