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


Groups > comp.lang.python > #74343

base64 convert to binary by binascii is that right?

Newsgroups comp.lang.python
Date 2014-07-11 00:06 -0700
Message-ID <6990c637-0d84-4ce4-b6ef-892290e56c74@googlegroups.com> (permalink)
Subject base64 convert to binary by binascii is that right?
From Frank Liou <fk26541598fk@gmail.com>

Show all headers | View raw


    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)

first 

getbody trans to base64

then i convert to binary

is that right?

getbody is '123AAA!!中文'


this is my result 123AAA\357\274\201\357\274\201\344\270\255\346\226\207


Back to comp.lang.python | Previous | NextNext 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