Reading from file up to arbitrary byte.

David M. Wilson at
Fri Feb 13 23:17:46 CET 2004


Is there a simple way of reading from a file object up to a specific 
byte value? I would like to do this without reading one character at a 
time, or reading in chunks and holding a remainder over.

Failing that, as a lightheartedly proposed extension, what do people 
think of:

	my_file.readline(line_terminator = "\x7f")
	my_file.line_terminator = "\x7f"

Does anyone know of a publically available subclass of file that would 
allow such, or similar behaviour?



More information about the Python-list mailing list