How to print a file in binary mode

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Oct 22 15:06:08 CEST 2006


In <1161519385.614985.311240 at m73g2000cwd.googlegroups.com>, Lucas wrote:

> I need print a file in binary mode .
> 
> f = f.open('python.jpg','rb')
> bytes = f.read()
> f.close()
> 
> print(bytes)
> 
> I can't get any binary code.

What do you mean by "binary code"?  If you use ``print repr(bytes)``
everything outside ASCII will be printed as escape sequence.

But why do you want to "print" JPEG images anyway?

Ciao,
	Marc 'BlackJack' Rintsch




More information about the Python-list mailing list