I have a python script that is pulling data from a MySQL database.
Here is a snippet that I use to write the results of the query to file:
cursor = conn.cursor ()
rows = cursor.fetchall ()
for row in rows:
for col in row:
output.write("%s\t" % (col))
My problem is that multiple fields in the query results are free form text and actually include line returns. Put another way there are multiple fields in the database table being queried that contain free form text including multiple lines and the line returns that come with them.
I need some insight on how I can keep those line returns confined to the one field when I write them to my .csv file and not actually wrapping around to the next line.