Reputation: 3425
c.execute("select a, c, d from table")
for row in c:
print(row)
Whenever I go this, the output is always:
('text field 1', 'text field 2', 'text field 3', 'text field 4')
I've been googling and cannot find the answer, is there a way I can make it like
text field 1, text field 2, text field 3, text field 4
?
Upvotes: 0
Views: 78
Reputation: 31568
or you can use this
from itertools import imap
",".join(imap(str, row))
Upvotes: 0
Reputation: 1124988
You printed the whole row, which is a tuple. To print it with a little formatting, you could use ''.join()
:
', '.join(row)
Upvotes: 3