Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Y.Turner@Hotmail.Com:Yvette Turner
  2. Kelliekelly@Hotmail.Com:Kellie Kelly
  3. Hades2056@Hotmail.Com:James Gillam
  4. Peter.Garrad@Tesco.Net:Carl Garrad
  5.  
  6. Hades2056@Hotmail.Com
  7. Peter.Garrad@Tesco.Net
  8.  
  9. file_1 = open('1.txt', 'r').read().split('n')
  10. file_2 = open('2.txt', 'r').read().split('n')
  11.  
  12. array = []
  13. for email in file_1:
  14. if email.split(':')[0] not in file_2:
  15. array.append(email)
  16.  
  17. str = ""
  18. for email in array:
  19. str += email
  20. str += 'n'
  21.  
  22. file_3 = open('3.txt', 'w')
  23. file_3.write(str)
  24.  
  25. import csv
  26.  
  27. fn1 = r'C:Temp.data616780_1.txt'
  28. fn2 = r'C:Temp.data616780_2.txt'
  29.  
  30. with open(fn1) as f1, open(fn1 + '.new', 'w') as fout, open(fn2) as f2:
  31. mails = set(f2.read().splitlines())
  32. csv_writer = csv.writer(fout, delimiter=':', quoting=csv.QUOTE_MINIMAL)
  33. for row in csv.reader(f1, delimiter=':'):
  34. if not row[0] in mails:
  35. csv_writer.writerow(row)
  36.  
  37. Y.Turner@Hotmail.Com:Yvette Turner
  38. Kelliekelly@Hotmail.Com:Kellie Kelly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement