Letter Frequency: get frequencies to print in order from most to least used
<p>I want to write a program that reads letters from a text file, ignoring symbols and whitespace, and prints the counts of each letter in order from most common to least common.</p>

<p>IN ADDITION, I am working on this for my first programming class, so I am not allowed to use counters. </p>

<p>I have this so far:</p>

<pre><code>name= raw_input("Enter file name:")
fl= open(name, 'r+').read()
lw= fl.lower()
ws= lw.replace(' ','')
sm= ws.translate(None, ",-!.;?:")
occ= {}
alpha= list ('abcdefghijklmnopqrstuvwxyz')
for x in alpha:
    occ[x]= sm.count(x)
for x in occ:
    print x, occ[x]
</code></pre>

<p>Pretend the text file is something like: "I am highly confused by this?"</p>

<p>Then the program will go through it's programming and do this: "iamhighlyconfusedbythis"</p>

<p>But right now it only show something like this:</p>

<pre><code>1   a
1   b
1   c
1   d
1   e
1   f
1   g
3   h
3   i
0   j
0   k
1   l
1   m
1   n
1   o
0   p
0   q
0   r
2   s
1   t
1   u
0   v
0   w
0   x
2   y
0   z
</code></pre>

<p>But I want the result to look like:</p>

<pre><code>3   h
3   i
2   s
2   y
1   e
1   f
1   g
1   a
1   b
1   l
1   m
1   n
1   o
1   c
1   t
1   u
1   d
0   j
0   k
0   p
0   q
0   r
0   v
0   w
0   x
0   z
</code></pre>

<p>I used ideas from: </p>

<p>spyshyguy</p>

<p><a href="http://stackoverflow.com/questions/992408/determining-letter-frequency-of-cipher-text-in-python">Determining Letter Frequency Of Cipher Text In Python</a></p>

<p>SimplyZ</p>

<p><a href="http://stackoverflow.com/questions/5148903/letter-frequency-in-python">Letter frequency in python</a>        </p>
