removing characters from mysql query results in python

mysql, python

Solution

The result from `fetchall()` is a `list of tuples` and not a list of strings.

print row[0]

Problem

I am trying to print a tuple in python from a mysql query. An example query is as follows: ``` query = ("show databases;") cursor.execute(query) for row in cursor.fetchall(): print (row) ``` The output is as follows: ``` ('database1',) ('database2',) ('database3',) ``` How can I remove the characters (parenthesis and single quote) from tuple so that my output looks like this: ``` database1 database2 database3 ```

Original source