Reading from file up to arbitrary byte.

David M. Wilson dw-google.com at botanicus.net
Fri Feb 13 23:17:46 CET 2004


Hello!

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")
or
	my_file.line_terminator = "\x7f"


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

Thanks,


David.




More information about the Python-list mailing list