On Feb 21, 7:02 pm, "Colin J. Williams" <[EMAIL PROTECTED]> wrote:
> 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.

Thanks for the help.

I tried doing this:

text = 'supercalifragilisticexpialidocius'

open('sambleb.conf', 'wb').write(text)

Afterwards, I was able to successfully open the file with a text
editor and it showed:
'supercalifragilisticexpialidocius'

I am hoping to have it show up some weird un-readable text. And then
of course be able to convert it right back to a string. Is this even
possible?

Thanks,

Harlin

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to