[Tutor] Logfile multiplexing

Stephen Nelson-Smith sanelson at gmail.com
Tue Nov 10 17:25:13 CET 2009


On Tue, Nov 10, 2009 at 3:59 PM, Stephen Nelson-Smith
<sanelson at gmail.com> wrote:
> On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith
> <sanelson at gmail.com> wrote:
>
>> OK, so now i've given it the full load of logs:
>>
>>>>> for time, entry in kent.logs:
>> ...   print time, entry
>> ...
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in ?
>> ValueError: too many values to unpack
>>
>> How do I get around this?!
>
> Erm, and now it's failing with only one logfile...
>
> Code here:
>
> http://pastebin.ca/1665013

OK - me being dumb.

So what I want to do is be able to multiplex the files - ie read the
next line of all 12 files at once, filter them accordingly, and then
write them out to one combined file.

My old code did this;

min((x.stamp, x) for x in logs)

What's the best way to do this now I'm using an iterable LogFile class?

S.


More information about the Tutor mailing list