[IronPython] memoryview

Jeff Hardy jdhardy at gmail.com
Thu Jun 2 00:01:49 CEST 2011

On Wed, Jun 1, 2011 at 2:50 PM, Peter Schwalm <ps at peter-schwalm.de> wrote:
> In the moment, I can only hope that no information is lost during the
> implicit conversions of file i-o. That means I hope these conversion simply
> add a 0-byte to every byte read in to make it unicode and only discards the
> 0-byte when writing to a file.

I'm 99% sure that's how it works.

One other option that I forgot about is the 2.7 io module:

    f = io.open('data.txt', 'rb')
    b = f.read()

Passing the 'b' flag to open causes it to return bytes instead of
strings, which should give you what you want.

- Jeff

More information about the Ironpython-users mailing list