0

I have a data structure:

[{u'inch': [{3.5: u'3 1/2'}, {u'0.340': u'0.340'}, {u'0.560': u'0.560'}]}, {u'mm': [{40.0: Decimal('40.0')}, {70.0: Decimal('70.0')} {50.0: Decimal('50.0')}}]

I need to sort it {**3.5**: u'3 1/2'}, first value of dict. I need to get result:

[{u'inch': [{u'0.340': u'0.340'}, {u'0.560': u'0.560'}, {3.5: u'3 1/2'}]}, {u'mm': [{40.0: Decimal('40.0')}, {50.0: Decimal('50.0'), {70.0: Decimal('70.0')}}]

This code doesn't work:

[{k: sorted(v)} for k, v in attr_dict.items()]
Joe Smart
  • 751
  • 3
  • 10
  • 28

0 Answers0