Receive data from socket stream

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Apr 28 21:04:42 EDT 2008


En Mon, 28 Apr 2008 19:29:33 -0300, <s0suk3 at gmail.com> escribió:

> A question regarding cStringIO.StringIO(): is there a way to do get
> getvalue() to return all the bytes after the current file position
> (not before)? For example
>
> buf = cStringIO.StringIO()
> buf.write("foo bar")
> buf.seek(3)
> buf.getvalue(True) # the True argument means
>                    # to return the bytes up
>                    # to the current file position
>
> That returns 'foo'. Is there a way to get it to return ' bar'?

buf.read() - the obvious answer, once you know it :)

-- 
Gabriel Genellina




More information about the Python-list mailing list