Skip to content

Instantly share code, notes, and snippets.

@brunokim
Created June 8, 2022 23:58
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 brunokim/5954c60eddfe2353e09264b38b89dce5 to your computer and use it in GitHub Desktop.
Save brunokim/5954c60eddfe2353e09264b38b89dce5 to your computer and use it in GitHub Desktop.
from collections import Counter
c = Counter()
with open('big_file.txt') as f:
for line in f:
c[line[:-1]] += 1 # Remove newline from line
for key, count in c.most_common():
print(f'{key} - {count}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment