[Tutor] Logfile multiplexing

Kent Johnson kent37 at tds.net
Tue Nov 10 19:03:56 CET 2009

On Tue, Nov 10, 2009 at 11:25 AM, Stephen Nelson-Smith
<sanelson at gmail.com> wrote:

> 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?

See the Python Cookbook recipes I referenced earlier.

Note they won't fix up the jumbled ordering of your files but I don't
think they will break from it either...


More information about the Tutor mailing list