On Thursday 15 April 2004 18:36, Angus Leeming wrote:
> >   Elegant, isn't it? ;-)
>
> Yes, but it would be more elegant still if I could save the stream
> rather than convert it to a list. Is that possible?

  Use *read* instead of *readlines*:

read(...)
    read([size]) -> read at most size bytes, returned as a string.

    If the size argument is negative or omitted, read until EOF is reached.
    Notice that when in non-blocking mode, less data than what was requested
    may be returned, even if no size parameter was given.

readlines(...)
    readlines([size]) -> list of strings, each a line from the file.

    Call readline() repeatedly and return a list of the lines so read.
    The optional size argument, if given, is an approximate bound on the
    total number of bytes in the lines returned.

 ******************************

  So you have what you asked for. ;-)

-- 
José Abílio

LyX and docbook, a perfect match. :-)

Reply via email to