0
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

?

2 Answers 2

3

You printed the whole row, which is a tuple. To print it with a little formatting, you could use ''.join():

', '.join(row)
Sign up to request clarification or add additional context in comments.

1 Comment

@RocketDonkey: I just did so! [-_-]~
0

or you can use this

from itertools import imap

",".join(imap(str, row))

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.