Iterating over marshal

Fredrik Lundh fredrik at pythonware.com
Fri Oct 6 16:19:35 EDT 2006


Tim Lesher wrote:

> I'm using the marshal library to unmarshal a file containing one or
> more objects.  The canonical way seems to be:
> 
> objs = []
> while 1:
>     try:
>         objs.append(marshal.load(fobj))
>     except EOFError:
>         break

the canonical way to do this is to put the objects in a sequence 
container *before* marshalling them.

</F>




More information about the Python-list mailing list