SHARE
TWEET

Python Agent-Sorting Tool

a guest Mar 12th, 2013 174 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import csv
  2.  
  3. infile = open('agents.csv', "r")
  4. reader = csv.reader(infile)
  5. inputlist = []
  6. for row in reader:
  7.     inputlist.append(row)
  8. infile.close()
  9.  
  10. outputlist = {}
  11.  
  12. for row in inputlist:
  13.     if row[2] in outputlist:
  14.         outputlist[row[2]] += 1
  15.     else:
  16.         outputlist[row[2]] = 1
  17.  
  18. for row in sorted(outputlist):
  19.     if outputlist[row] > 1:
  20.         print(row + " - " + str(outputlist[row]))
RAW Paste Data
Top