[Tutor] IP sorting

ccl chrislubrecht@home.com
Wed, 26 Dec 2001 21:27:54 -0500

This may be somewhere, and I am just being lazy, but its something I need 
to fix...

I am currently writing a script to analyze proxy server logs. One section 
of the script scrubs out the IP addresses, counts them and sorts them and 
prints them in a nice ordered way with the IP, then the number of hits. 
(ie. " ----- 356 hits")

Basically, what I am doing is creating a dictionary with the IP as the key, 
and the result of string.count() as the entry.

then I do...

dead_bishop = ip_dictionary.keys()
for item in dead_bishop:
  print item," ---- ",ip_dictionary[item]," hits"

All is good, it works well, however it only sorts to the second place of 
the last octet. For example... --- 5 hits --- 10 hits --- 3 hits --- 22 hits

How do I get the to go where it supposed to (at the beginning)?