Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wu8eV-0001C0-67 for pgsql-sql@arkaria.postgresql.org; Mon, 09 Jun 2014 23:06:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wu8eU-0006JV-EU for pgsql-sql@arkaria.postgresql.org; Mon, 09 Jun 2014 23:06:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wu8eT-0006JO-2R for pgsql-sql@postgresql.org; Mon, 09 Jun 2014 23:06:53 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wu8eO-0006fY-VG for pgsql-sql@postgresql.org; Mon, 09 Jun 2014 23:06:51 +0000 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id AE96C22044; Mon, 9 Jun 2014 19:06:46 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Mon, 09 Jun 2014 19:06:46 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s=mesmtp; bh=O8dMtkRIvEZEfY1paTlCWMoe41A=; b=lgJUg7ZeJ6uMVFq1CVK/rKavrw2Y FgLAygK1PsLuKkzD8qAWoDv/iHHXJ7ub5O9NjToC5sWM/b3GYdUwS1mCItRuMELT qYzTXIOo3zwixVhirSyvRqPVdlCSPBQeYiIMRT19QRz2kSr0OqHN0PjzN6FvOIXf bQ8gN6W7kYZFyYw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=O8dMtkRIvEZEfY1paTlCWM oe41A=; b=uvJnv8s6lVlv7tk633XyxHSh6U95zWOoINNSpJHhpT1b2us1amHAEJ b1gKwcIQcWQFOj4A7WJpJYrCSt6Ws/IwI963bU9HY4B1vWGoZ68aD/Zo6jI5J5sm pXhhInhZoZdO4iTWfnATl7NGbECEWr8LCuUz1rcRZGpQPCcHHxezU= X-Sasl-enc: UanVCn4me7N1+3wDktlswnhpln6r/4/uFC3BVBFvn4+r 1402355206 Received: from killi.site (unknown [24.17.179.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 1ADCF680119; Mon, 9 Jun 2014 19:06:46 -0400 (EDT) Message-ID: <53963E06.70507@aklaver.com> Date: Mon, 09 Jun 2014 16:06:46 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Bruce , pgsql-sql@postgresql.org Subject: Re: Problem with strange chars in text filed. References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 06/09/2014 09:02 AM, Bruce wrote: > I have a table: > create table truck (name varchar(45),address varchar(150)); > > doing an insert: > for i in range (0,10): > meme = fake.name () > address = fake.address() > print (meme,address) > cur.execute("INSERT INTO TRUCK2 VALUES (%s, %s)", ([meme], [address])) > conn.commit() Assuming you are using psycopg2 the answer is here: http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries so: cur.execute("INSERT INTO TRUCK2 VALUES (%s, %s)", (meme, address)) or cur.execute("INSERT INTO TRUCK2 VALUES (%s, %s)", [meme, address]) > > Help > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql