I am selecting data from a database in python.
cur.execute("Select a,b,c from tab1")
print "a,b,c"
print "\n"
data = cur.fetchall()
print "".join(str(e) for e in data).replace("(","").replace(")","")
I want to put a newline character at the end of each row.
Output should look like
a,b,c
A,B,C //These values are from the database.
D,E,F
Thanks
Try:
instead of:
as the former command will insert a newline between each data string whereas the latter inserts an empty string (i.e. nothing).