How to print a file in binary mode

Fredrik Lundh fredrik at pythonware.com
Sun Oct 22 10:55:11 EDT 2006


Lucas wrote:

> I do it because I want to encrypt a string into a picture using RSA
> algorithm.

what does "into" mean?  are you supposed to encrypt the binary data 
representing the JPEG image, or embed a message into the actual image?

 > so I first convert the string to binary,and then saving the binary
 > into picture

you seem to have a rather fuzzy understanding of the words "string" and 
"binary" here.  if you read from a file that's opened in binary mode, 
you get an 8-bit string that contains the binary data.  there's no need 
for any conversion here; just use the data you got from "read".

 > finally, print the picture by binary!

do you mean "save the picture to a binary file", or something else?

</F>




More information about the Python-list mailing list