Skip to content

Instantly share code, notes, and snippets.

@SeanPlusPlus
Created March 24, 2011 20:57
Show Gist options
  • Save SeanPlusPlus/885863 to your computer and use it in GitHub Desktop.
Save SeanPlusPlus/885863 to your computer and use it in GitHub Desktop.
list de-duplication in ipython
% 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