You could use sorted
. The following solution works, provided the value of ‘id’ starts with a single character followed by numbers.
sorted(b, key=lambda x: int(x['id'][1:]))
1
solved How to sort a list by dict values in Python? [closed]
You could use sorted
. The following solution works, provided the value of ‘id’ starts with a single character followed by numbers.
sorted(b, key=lambda x: int(x['id'][1:]))
1
solved How to sort a list by dict values in Python? [closed]