examples/files/count_numbers.py
from __future__ import print_function
import sys

if len(sys.argv) < 2:
    exit("Need name of file")

counter = [0] * 10
file = sys.argv[1]
fh = open(file, 'r')
for line in fh:
    for c in list(line.rstrip("\n")):
        if c == ' ':
            continue
    
        c = int(c)
        counter[c] += 1

for i in range(10):
    print("{} {}".format(i, counter[i]))