When doing a query of a certain line of a database (MySQl) with python, the output it offers is of the type:
Db_Host = '****'
Db_Urs = '****'
Db_Pass = '****'
Db_Name = '****'
def run_query(query=''):
datos = [Db_Host, Db_Urs, Db_Pass, Db_Name]
conexion = MySQLdb.connect(*datos)
cursor = conn.cursor()
cursor.execute(query)
if query.upper().startswith('SELECT'):
data = cursor.fetchall()
else:
conexion.commit()
data = None
cursor.close()
connexion.close()
return data
x = run_query(query='SELECT dni FROM empleados limit 1')
print x
With this output:
((' 75849332D ',),)
I would need to know if that output (probably tuple), can become a string to be able to modify it later, that is, that it looks like a normal string:
75849332D
Thank you very much