how to count number of digits in a text file in python