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