[Tutor] Counting & Sorting Instances In File

Michael Barrett mike@daboyz.org
Wed May 14 18:14:01 2003


    I realized (since I've gotten one reply already that pointed it out) that I'm not too clear on just which part of this I need help with.  I know how to open the file, grab the data, and then parse it out.  I also thought about storing the counts as a dictionary, ie using the addresses as the keys with the 'counts' being the values.

    The hard (?) part is the sorting.  Thats the part I need help with, so assume a dictionary of 'Email': count values.  If you can think of a better way of storing the data in memory for my sort, that'd be appreciated as well.  Thanks again.

On Wed, May 14, 2003 at 02:47:09PM -0700, Michael Barrett wrote:
>     Ok, so, I'm not sure why this is giving me such a hard time right now (maybe it's lack of sleep, don't you love those weeks?) but pretty much I'm looking for a good way to go through a logfile of outgoing mail attempts and count the # of mails going to each mail address- and then sort that list so that I can display the top 25.  Anyone got any suggestions?  This is making me feel like a total idjit.
> 
>     Thanks for your help.
> -- 
>      ________________________________________________________________________
>                 Mike Barrett | "I used to read, now I go to raves."
>              mike@daboyz.org | -- Random MUNI Rider, speaking
>               www.daboyz.org |    to my friend Allison.
>      ------------------------+-----------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
     ________________________________________________________________________
                Mike Barrett | "I used to read, now I go to raves."
             mike@daboyz.org | -- Random MUNI Rider, speaking
              www.daboyz.org |    to my friend Allison.
     ------------------------+-----------------------------------------------