Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'encoded': 0.07; 'lines,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'wrote': 0.14; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'specifying': 0.16; 'version.': 0.19; 'replace': 0.24; 'asking': 0.27; 'header:X-Complaints-To:1': 0.27; 'rest': 0.29; 'subject:that': 0.31; 'skip:c 30': 0.32; 'something': 0.35; 'subject:?': 0.36; 'two': 0.37; 'to:addr :python-list': 0.38; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'subject: ': 0.61; "you're": 0.61; 'show': 0.63; 'frank': 0.68; 'subject::': 0.85 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re:base64 convert to binary by binascii is that right? Date: Fri, 11 Jul 2014 05:26:27 -0400 (EDT) Organization: news.gmane.org References: <6990c637-0d84-4ce4-b6ef-892290e56c74@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-97-195-156.hstntx.dsl-w.verizon.net X-Newsreader: PiaoHong.Usenet.Client.VIP:1.56 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405070670 news.xs4all.nl 2933 [2001:888:2000:d::a6]:37489 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74353 Frank Liou 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