I have a function that takes a code from the postgreSQL database and displays it set to QLabel
with the function setText()
.
The problem is that this code comes from the database in odd format, between parentheses and comma. Example: (VI1,)
.
How do I remove these parentheses and commas?
Function:
def cod_via(self,nome_via):
cursor = self.connectBanco()
sql = "SELECT cod_via FROM espacial.via WHERE nome_via = '%s'"%nome_via
cursor.execute(sql)
resultado = cursor.fetchall()
return resultado
I'm displaying with:
cod = instancia_sql.cod_via(nome_via)
self.dlg.label_resul.setText(str(cod))