AttributeError

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Aug 12 04:46:05 CEST 2015


On 12/08/2015 01:49, Chris Angelico wrote:
> On Wed, Aug 12, 2015 at 10:43 AM, Ltc Hotspot <ltc.hotspot at gmail.com> wrote:
>> Python can pull the hour from the 'From ' line by finding the time and then
>> splitting the string a second time using a colon, i.e., From
>> stephen.marquard at uct.ac.za Sat Jan  5 09:14:16 2008
>>
>> Finally, accumulated the counts for each hour, print out the counts, sorted
>> by hour as shown below:
>
> In that case, you want to sort the entire collection, not a single
> key-value pair.
>
> It seems to me you can do this fairly efficiently with collections.Counter.
>

Which is exactly what the OP was told on the tutor mailing list several 
days ago, and he's also asked on the core mentorship list earlier today 
as well.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list