I am writing a small Python program for the use in our departments stockroom. This is what I have come up with (just starting):
# table of chemicals in stockroom # order --> stock number, chemical name, quantity (grams) # short version of the table table = [ ['ud-99137', 'm-chlorobenzoic acid', 750], ['ud-99672', 'potassium carbonate', 5000], ['ud-99083', 'aluminum chloride anh', 3500] ] # pretty print the table print '-'*66 print "%-10s %-40s %s" % ('stock', 'chemical', 'quantity(g)') print '-'*66 for item in table: print "%-10s %-40s %8d" % (item, item, item) print '-'*66
For right now I would like to sort this list of lists by stock number, chemical name and quantity on hand. Any ideas?