[Zope] Base64 - Encoding/Decoding without external method
Andy Dustman
farcepest at gmail.com
Mon Feb 7 14:13:49 EST 2005
On Fri, 4 Feb 2005 13:58:20 +0100 (CET), Andrea Lombardoni
<lombardo at inf.ethz.ch> wrote:
> I would like to decode/encode data in base64 without resorting
> to an external Python method.
The following is in the Python interpreter, but I have verified that
it works for Python scripts in Zope.
Python 2.3.4 (#1, Jul 30 2004, 09:49:24)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "Hello World!".encode('base64')
'SGVsbG8gV29ybGQh\n'
>>> 'SGVsbG8gV29ybGQh\n'.decode('base64')
'Hello World!'
>>> 'Clguba ebpxf!'.decode('rot13')
u'Python rocks!'
--
Computer interfaces should never be made of meat.
Using GMail? Setting Reply-to address to <> disables this annoying feature.
More information about the Zope
mailing list