Python Forum

Full Version: [split] Any improvements
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I design a code Python Program Code for Sort File In System : -
#!/usr/bin/env python

from __future__ import print_function  # Only for Python < 3; but harmless

import sys

from collections import Counter

 

data = Counter()

data.update([line.strip() for line in sys.stdin.readlines()])

print('\n'.join(['%s\t%s' % (y,x)  for x,y in data.most_common(20)]))
Don't post links like those in the forum, it is not tolerated