base64 and PyGreSQL

Guido van Rossum guido at
Thu May 18 23:47:49 EDT 2000

Agent Drek wrote:
> Why does the base64 module append a '\012'?
> I'm using base64 to send data into a PostgreSQL database so that
> arbitrary data including ''s and "'s can be entered by the user's ...
> is this the correct way to do this?
> right now :
> string.strip(base64.encodestring(eggs))
> I'm using PyGreSQL.

You seem to have found the solution for your problem.

The answer to the "why" question is simply that in the context
for which base64 was originally designed (encoding binary files
as part of email) the output is always a number of lines,
so it makes sense to add the linefeed.

--Guido van Rossum (home page:

More information about the Python-list mailing list