fork download
  1. data = {"sizes": [
  2. {
  3. "height": 173,
  4. "width": 130
  5. },
  6. {
  7. "height": 130,
  8. "width": 97
  9. },
  10. {
  11. "height": 267,
  12. "width": 200
  13. }
  14. ]}
  15.  
  16. sizes = sorted(data, key=data['sizes']['height'], reverse=True)
  17. print(sizes)
Runtime error #stdin #stdout #stderr 0.15s 23508KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 16, in <module>
TypeError: list indices must be integers or slices, not str