[Tutor] postgreSQL + psycopg2

Alan Gauld alan.gauld at yahoo.co.uk
Tue May 10 18:27:27 EDT 2016


On 10/05/16 08:33, nitin chandra wrote:

> here is the result.
> 
> 1
> ('Supervisor',)
> <tr>
> <td>1</td>
> <td>Vinayak</td>
> <td>Salunke</td>
> <td>1</td>
> 
> Now I need to remove the braces and quotes .. :)

No you don't. Those are just part of the string representation
that Python uses when printing a string inside a tuple.

If you print nextRow[0] instead of nextRow you
will get the bare string.

BTW Why are you using triple quotes? You only need them if
your string wraps over multiple lines. Single quotes (" or ')
will be fine for your purposes and are easier to type...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list