Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74353

Re:base64 convert to binary by binascii is that right?

From Dave Angel <davea@davea.name>
Subject Re:base64 convert to binary by binascii is that right?
Date 2014-07-11 05:26 -0400
Organization news.gmane.org
References <6990c637-0d84-4ce4-b6ef-892290e56c74@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.11757.1405070670.18130.python-list@python.org> (permalink)

Show all headers | View raw


Frank Liou <fk26541598fk@gmail.com> Wrote in message:
>     conn = engine.connect()
>     encoded = base64.b64encode(getbody)
>     binary_string = binascii.a2b_base64(encoded)
>     puresql = sqla.text("INSERT INTO friends(name) VALUES(:binary_string)")
>     conn.execute(puresql,binary_string = binary_string)
> 
> 

Start by specifying Python version. 

Since you're only asking about two lines,  replace the rest with
 something that people can actually run. And instead of just
 printing binary_string,  show its type as well. 


-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

base64 convert to binary by binascii  is that right? Frank Liou <fk26541598fk@gmail.com> - 2014-07-11 00:06 -0700
  Re:base64 convert to binary by binascii  is that right? Dave Angel <davea@davea.name> - 2014-07-11 05:26 -0400

csiph-web