Advertisement
Ankhwatcher

Sort GDG

Oct 16th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import csv
  3. import sys
  4.  
  5. print "Sorting GDG Attendees"
  6. #with open('GLYNNRORY-20130127.csv', 'rb') as f:
  7. with open(sys.argv[1], 'rb') as f:
  8.     reader = csv.reader(f)
  9.    
  10.     #ssToFind = raw_input("What are we looking for? ")
  11.  
  12.     #HashMap of email addresses (Python Dictionary)
  13.     emailMap = {};
  14.     for row in reader:
  15.         if row[3] in emailMap:
  16.             if len(row[4])>3:
  17.                 values = emailMap[row[3]]
  18.                 #broken here
  19.                 values[0] = values[0]+1
  20.             else:
  21.                 values = emailMap[row[3]]
  22.                 values[1] +=1
  23.         else:
  24.             if len(row[4])>3:
  25.                 emailMap[row[3]] = {1,0}
  26.             else:
  27.                 emailMap[row[3]] = {0,1}
  28.  
  29.     for key, value in emailMap.iteritems():
  30.         print key+" - ",+value[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement