While I am trying to run the following basic python script for fetching data in postgresql database using psycopg2 module :
cur.execute("""SELECT project from project_tlb""")
rows=cur.fetchall()
print rows[5]
the output for above I am getting is
('html',)
The value inside the table is html which is of type 'text'. Any suggestions how to get only the value html instead of ('html',) ?
The returned value ('html',)
is a tuple
so you can just access its first element:
rows[5][0]
to get
'html'