Guest User

Untitled

a guest
Apr 4th, 2018
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import MySQLdb
  2. import sys
  3.  
  4. host = 'localhost'
  5. username = 'capillary'
  6. password = 'deal20hunt'
  7. database = 'veneno_data_details'
  8.  
  9. #con = MySQLdb.connect(host, username, password, database);
  10. #cursor = con.cursor()
  11.  
  12. file = open('somefile.csv', 'r')
  13. file_inp = file.readlines()
  14.  
  15. some_map = {}
  16.  
  17. for a in file_inp:
  18. nsadmin_id, org_id, message_id = a.rstrip().split(',')
  19. nsadmin_id = nsadmin_id.strip('"')
  20. org_id = org_id.strip('"')
  21. message_id = message_id.strip('"')
  22. if (message_id, org_id) not in some_map:
  23. some_map[(message_id, org_id)] = list()
  24. some_map[(message_id, org_id)].append(nsadmin_id);
  25. #print nsadmin_id, org_id, message_id;
  26.  
  27. for a, b in some_map:
  28. print key, value
Add Comment
Please, Sign In to add comment