S
Sven Brandt
Hi there,
please excuse for asking such basic questions (I am new to programming, esp.
python).
I have a list of dictionaries. I want the elements of the list to be sorted by
the value of a key of the dict .
Excample:
my_list=[{'title': 'foo', 'id': 5, 'text': 'some text'},
{'title': 'bar', 'id': 3, 'text': 'my text'},
{'title': 'bla', 'id': 6, 'text': 'any text'}, ]
my_list.sort("by the id value")
Thanx for help
Sven
please excuse for asking such basic questions (I am new to programming, esp.
python).
I have a list of dictionaries. I want the elements of the list to be sorted by
the value of a key of the dict .
Excample:
my_list=[{'title': 'foo', 'id': 5, 'text': 'some text'},
{'title': 'bar', 'id': 3, 'text': 'my text'},
{'title': 'bla', 'id': 6, 'text': 'any text'}, ]
my_list.sort("by the id value")
Thanx for help
Sven