Psycopg2 | collapse row to string

Demel, Jeff Jeff.Demel at JavelinDirect.com
Tue Nov 21 22:10:32 CET 2006


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.



More information about the Python-list mailing list