Skip to content

Instantly share code, notes, and snippets.

@andrulik
Created October 14, 2010 14:52
Show Gist options
  • Save andrulik/626294 to your computer and use it in GitHub Desktop.
Save andrulik/626294 to your computer and use it in GitHub Desktop.
import sys
from time import time
from collections import defaultdict
t = time()
w = defaultdict(set)
[w["".join(sorted(s.strip().lower()))].add(s) for s in open(sys.argv[1])]
for i, l in w.iteritems():
print "".join(l)
print time()-t,'s'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment