Im working with mysql.connection library to Python and I have this method:
query = ("select " + columns + " from " + table)
self.cursor.execute(query)
data = self.cursor.fetchall()
for row in data:
print row
In my print row, I get something like this:
(u'Kabul', u'AFG', u'Kabol', 1780000)
I would like to get it as a string, this result:
Kabul AFG Kabol 1780000
I can do this:
print row[0] + ' ' + row[1] + row[2] + ' ' + row[3]
But it will not work if the user sets a query with less than 4 columns or more than 4.
I also was thinking about a loop in my tuple, but I get this result:
Kabul
AFG
Kabol
1780000
Some idea?