How to read one byte at a time in Python?
Garry Knight
garryknight at gmx.net
Fri Mar 12 20:21:00 EST 2004
In message <mailman.335.1079137564.19534.python-list at python.org>, Anthony
Liu wrote:
> Java has functions that read only one byte at a time,
> do we have such a function in python?
inf = open('filename', 'r')
c = inf.read(1)
Depending on the meaning of the word 'byte' in your question, you might want
to make the file mode 'rb'.
--
Garry Knight
garryknight at gmx.net ICQ 126351135
Linux registered user 182025
More information about the Python-list
mailing list