You almost had it, but veered off-track somewhere there. :) dothis
doesn't return anything, so vld
and linux
are both going to be empty.
csv.reader
already "lines up" the values for you; it yields rows at a time. You're actually breaking them apart again when there's no need.
inf = csv.reader(open('data.txt','r'))
sortedlist = sorted(inf, key=operator.itemgetter(2), reverse=True)
for row in sortedlist:
src = row[0]
dst = row[1]
print src, dst