I need to get the data that is outputted by the program currently, in Alphabetical order. I am unaware of how to do this and would appreciate help from anyone who may know how!
Currently you are sorting the values of row[2] only.
For sorting a list of lists by items of the inner list you can use operator.itemgetter. Try this:
operator.itemgetter
import operator # do stuff print(sorted(data, key=operator.itemgetter(2))
to sort by your third column (index 2).
How can I alphabetically order the output!
I need to get the data that is outputted by the program currently, in Alphabetical order. I am unaware of how to do this and would appreciate help from anyone who may know how!
Currently you are sorting the values of row[2] only.
For sorting a list of lists by items of the inner list you can use
operator.itemgetter
. Try this:to sort by your third column (index 2).