Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. with open('group1', 'r') as file1:
  2. with open('group2', 'r') as file2:
  3. same = set(file1).difference(file2)
  4.  
  5. same.discard('n')
  6.  
  7. with open('some_output_file.txt', 'w') as file_out:
  8. for line in same:
  9. file_out.write(line)
  10.  
  11. group1:
  12. test:x:1234:mike,john,scott
  13. test2:x:1234:mike,john
  14. test3:x:1234:tim,dustin,Alex
  15.  
  16. group2:
  17. test:x:1234:mike,scott,john
  18. test2:x:1234:mike,john,scott
  19. test3:x:1234:dustin,tim
  20.  
  21. missing group1:
  22. test2:scott
  23.  
  24. missing group2:
  25. test3:Alex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement