Convert to binary and convert back to strings

Colin J. Williams cjw at sympatico.ca
Wed Feb 21 19:02:17 EST 2007


Harlin Seritt wrote:
> Hi...
> 
> I would like to take a string like 'supercalifragilisticexpialidocius'
> and write it to a file in binary forms -- this way a user cannot read
> the string in case they were try to open in something like ascii text
> editor. I'd also like to be able to read the binary formed data back
> into string format so that it shows the original value. Is there any
> way to do this in Python?
> 
> Thanks!
> 
> Harlin
> 
Try opening your file in the 'wb' mode.

Colin W.




More information about the Python-list mailing list