base64 convert to binary by binascii is that right?

Dave Angel davea at davea.name
Fri Jul 11 05:26:27 EDT 2014


Frank Liou <fk26541598fk at 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




More information about the Python-list mailing list