I'm using psycopg2 and I'd like to know if there's a way to generate some cleaner output from my SELECT statements.
My data looks like this in the database:
("Apple" user:(Apple) tag:(Apple))
When I pull the data down through psycopg2, it looks like this:
('("Apple" user:(Apple) tag:(Apple))')
I'd like it to not append those characters to the front and end of each row, is there a cleaner method to do it? Code follows.
cur.execute('''
select field from table;
''')
rows = cur.fetchall()
for row in rows:
# Write rows to text file
writer.write(row + '\n')