Skip to content
Advertisement

Python and PostGres | Showing data in a QLabel (psycopg2)

im using Postgres together with python(psycopg2). Im trying to insert data in a QLabel. It shows the data, but the data comes with clinges. How do I get rid of the clinges?

My code:

JavaScript

This is what I get out of it:

I want it to just show 12

Advertisement

Answer

Per here Cursor:

Note

cursor objects are iterable, so, instead of calling explicitly fetchone() in a loop, the object itself can be used:

cur.execute(“SELECT * FROM test;”) for record in cur: print record

(1, 100, “abc’def”)

(2, None, ‘dada’)

(3, 42, ‘bar’)

So to simplify:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement