Apr-21-2020, 07:23 PM
I'm selecting data from a table and returning all records. However, the records are being returned with a blank space separator instead of a comma. Any idea how to return rows like the following:
Output:1,sales,marketing,04212020Instead of:Output:1 sales marketing 04212020Here's the function:def select_from_database(conn, tablename):
cursor = conn.cursor()
print("Connected to: %s" % database)
cursor.execute("SELECT * FROM %s " % tablename)
rows = cursor.fetchall()
print("Total records: %s" % len(rows))
for i in rows:
print(*i)
#print("%s %s" % (row[0], row[1]))
cursor.close()Thanks!
