I have a list
contains custom object Box
. I want to sort
the list alphabetically with a String
property of the object Box
.
I have tried boxList.sort()
, boxList.name.sort()
. It does not work.
class Box(object):
name = “”
num = 0
...
box = Box(name, num)
boxList.append(box)
I have a list of box in boxList
. I want to sort boxList
alphabetically by the String name
contains in boxList
.