[Tutor] Tutor Digest, Vol 104, Issue 24
Aceway
aceway at qq.com
Thu Oct 4 21:57:36 CEST 2012
your last for iterater maybe should like this:
for key,values in messages:
if max is None or values>max:
sender=key
max=values
在 2012-10-5,1:13,tutor-request at python.org 写道:
> Send Tutor mailing list submissions to
> tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-request at python.org
>
> You can reach the person managing the list at
> tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
> 1. Hello Can someone looked at my problem? stuck (Palice Fan)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 2 Oct 2012 23:39:00 -0400
> From: Palice Fan <magicwizardstar at gmail.com>
> To: tutor at python.org
> Subject: [Tutor] Hello Can someone looked at my problem? stuck
> Message-ID:
> <CAEqgQa4Aup6t+f237cfvkjkf54XRv2=PyMUXJqgzzka8gmet7Q at mail.gmail.com>
> Content-Type: text/plain; charset="windows-1252"
>
> Hello
> i got stuck with the last bit of my programming practice.
> Can somebody help me?
> Write a program to read through a mail log, and figure out who had the most
> messages in the file. The program looks for ?From? lines and takes the
> second parameter on
> those lines as the person who sent the mail.
> The program creates a Python dictionary that maps the sender?s address to
> the total number of
> messages for that person.
> After all the data has been read the program looks through the dictionary
> using a maximum loop
> (see Section 5.7.2) to find who has the most messages and how many messages
> the person has.
>
> Enter a file name: mbox-short.txt
> cwen at iupui.edu :5
> Enter a file name: mbox.txt
> zqian at umich.edu :195
>
> Instead of printing off a number beside the email, i got another email and
> i dont know how to fix it.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.python.org/pipermail/tutor/attachments/20121002/3fd4d310/attachment.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 9.4 stuck.png
> Type: image/png
> Size: 67410 bytes
> Desc: not available
> URL: <http://mail.python.org/pipermail/tutor/attachments/20121002/3fd4d310/attachment.png>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
> ------------------------------
>
> End of Tutor Digest, Vol 104, Issue 24
> **************************************
>
More information about the Tutor
mailing list