Convert tuples into string

Smaran Harihar smaran.harihar at gmail.com
Mon Nov 26 03:24:56 CET 2012


I was able to solve it using the following loop,

conn=psycopg2.connect(connstr)
cursor=conn.cursor()
cursor.execute("SELECT tablename FROM pg_tables where tablename like '%"+
inp +"%'")
 records = cursor.fetchall()
str=""
for rec in records:
 if str == "":
str="".join(rec)
else:
 m="".join(rec)
str=str+","+m

Thanks,
Smaran

On Sun, Nov 25, 2012 at 7:09 PM, Smaran Harihar <smaran.harihar at gmail.com>wrote:

> Hi Guys,
>
> I am connecting to postgres database and fetching the table names but it
> seems that they are being returned in <type 'tuple'>
>
> How can I convert them to string?
>
> --
> Thanks & Regards
> Smaran Harihar
>
>


-- 
Thanks & Regards
Smaran Harihar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121125/f8ea3a02/attachment.html>


More information about the Python-list mailing list