read text file byte by byte

Nobody nobody at nowhere.com
Mon Dec 14 16:09:52 EST 2009


On Sun, 13 Dec 2009 22:56:55 -0800, sjdevnull at yahoo.com wrote:

> The 3.1 documentation specifies that file.read returns bytes:

> Does it need fixing?

There are no file objects in 3.x. The file() function no longer
exists. The return value from open(), will be an instance of
_io.<something> depending upon the mode, e.g. _io.TextIOWrapper for 'r',
_io.BufferedReader for 'rb', _io.BufferedRandom for 'w+b', etc.

	http://docs.python.org/3.1/library/io.html

io.IOBase.read() doesn't exist, io.RawIOBase.read(n) reads n bytes,
io.TextIOBase.read(n) reads n characters.





More information about the Python-list mailing list