concatenate file-like objects -> file-like object

kgk kkvilekval at
Wed Jul 11 02:55:52 CEST 2007

I would like to concatenate several file-like objects
to create a single file-like object.  I've looked at fileinput,
this returns a fileinput object that is not very file-like.

something like
# a has 50 bytes, and b has 100 bytes
f = FileList (open('a'), open('b')) (100)  #  read 50 bytes from a and 50 from b

My interest is in passing several files to an incremental parser
as if they came from a single file.   I would rather not load them
in memory using StringIO and the parser reads only from file-like

Any pointers appreciated

More information about the Python-list mailing list