Created
April 7, 2023 01:56
-
-
Save realmovestar/d0349091a4f4f1ba2c67c97bac72cae2 to your computer and use it in GitHub Desktop.
uniq using python
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
import sys | |
import json | |
counts = dict() | |
for line in sys.stdin: | |
if line in counts: | |
counts[line] += 1 | |
else: | |
counts[line] = 1 | |
print(json.dumps(counts, indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment