Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cdhowie
Created October 27, 2015 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdhowie/87eac9417f35b2c5bf7a to your computer and use it in GitHub Desktop.
Save cdhowie/87eac9417f35b2c5bf7a to your computer and use it in GitHub Desktop.
#!/bin/env python
import fileinput
counts = {}
for line in fileinput.input():
chomped = line.rstrip('\r\n')
counts[chomped] = counts.get(chomped, 0) + 1
for line, count in counts.iteritems():
print "%d\t%s" % (count, line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment