Psycopg2 | collapse row to string

D

Demel, Jeff

I'm pulling some records from a database using psycopg2, then looping
through the rows to do some data checking and then writing the results
to a file if they pass some integrity checks.

Simple enough, but...

Is there an easy want to create a delimited string from this, for
example:

for row in rows:
if checksomething == 100:
newline = row[].combine("delimiter of some kind")
resultfile.write(newline)

Obviously, the "row[].combine(delimeter)" is what I'm hoping exists.

TIA

-Jeff

This email is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution or copying of this e-mail or any attachments by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is prohibited. If you are not the intended recipient of this message or the employee or agent responsible for delivery of this email to the intended recipient, please notify the sender by replying to this message and then delete it from your system. Any use, dissemination, distribution, or reproduction of this message by unintended recipients is strictly prohibited and may be unlawful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top