sorry about that queryString = "insert into venders values('{0}','{1}','{2}')".format(field1,field2,field3)
On Mon, Dec 15, 2008 at 7:21 AM, Lamonte Harris <pyth0nc0...@gmail.com>wrote: > I had this problem too. If you've upgraded to python 2.6 you need to use > the new sytnax "format > > queryString = "insert into venders > values('{0}','{1}','{2}'".format(field1,field2,field3) > > > On Mon, Dec 15, 2008 at 6:46 AM, Krishnakant <hackin...@gmail.com> wrote: > >> hello all hackers. >> This is some kind of an interesting situation although many of you must >> have already gone through it. >> I am facing a situation where I have to use psycopg2 and insert rows in >> a postgresql table. >> That's pritty easy and no need to say that it works well. But there are >> some entries which have an ' in the value. >> I have a venders table in my database and one of the values tryed was >> "His Master's Voice " >> now the master's word has the ' which is used for starting and ending a >> varchar value for postgresql or almost any standard RDBMS. >> Does any one know what is the way out of this? >> how do you let the ' go as a part of the string? >> I have used %s as placeholder as in >> queryString = "insert into venders values ('%s,%s,%s" % >> (field1,field2,field3 ) ... >> This is not working for the ' values. >> can any one suggest a suitable solution? >> happy hacking. >> Krishnakant. >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > >
-- http://mail.python.org/mailman/listinfo/python-list