I have the following code:
lst = []
class DATA:
def __init__(self):
s = ['','']
def fillLst():
d1 = DATA()
d1.s[0] = 'zebra'
d1.s[1] = 23
d2 = DATA()
d2.s[0] = 'airplane'
d2.s[1] = 435
d1 = DATA()
d1.s[0] = 'aira'
d1.s[1] = 211
lst.append(d1)
lst.append(d2)
lst.append(d3)
When I print the list I get the following:
zebra - 23
aira - 211
airplane - 435
Now I want to sort the list so that I get this output:
aira - 211
airplane - 435
zebra - 23
So how can I sort the list with the Data
objects in it?