Created
March 24, 2011 20:57
-
-
Save SeanPlusPlus/885863 to your computer and use it in GitHub Desktop.
list de-duplication in ipython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cat users.dupes | |
rocci | |
mikey | |
jamie | |
diana | |
rocci | |
glen | |
jesse | |
% ipython | |
In [1]: with open('users.dupes') as f: | |
...: users = set([ i.strip() for i in f ]) | |
...: | |
...: | |
In [2]: with open('users.uniq', 'w') as f: | |
...: f.write('\n'.join(users)) | |
...: | |
...: | |
% cat users.uniq | |
glen | |
diana | |
jamie | |
mikey | |
rocci | |
jesse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment