Cmag Cmag - 5 months ago 25
Python Question

How to convert a tuple to a string in Python?

After a MySQL select statement, I am left with the following:

set([('',), ('',), ('',), ('',), ('',), ('',), ('',), ('',)])

What I would like to have is a

emaillist = "\n".join(queryresult)

to in the end, have a string:

What would be the proper way to convert this nested tuple into string?


As long as you're sure you have just one element per tuple:

'\n'.join(elem[0] for elem in queryresult)