Post

PythonPython

J
James ROBERT

Posted on 27th February 2024|25 views

0
votes

Python Sort Objects By Attribute

How can I sort a list of objects based on the attribute of that object?

Answers
P
Lakshmi sowjanya

Posted on 27th February 2024

Try this

 

ut.sort(key=lambda y: y.count, reverse=True) 

 

newlist = sorted(ut, key=lambda y: y.count, reverse=True)

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos