On Fri, 07 Jun 2013 14:24:30 -0400, Dave Angel wrote:
> On 06/07/2013 01:44 PM, ethereal_r...@hotmail.com wrote: >> > <SNIP> >> >> rows = cur.fetchall() >> >> for row in rows: >> print row >> >> >> >> >> Now assume that fetchall would print the following: > > I doubt if fetchall() prints anything. presumably it returns something, > extracted from the db. > > >> LOEL910624ND5 from the column vat as RFC. >> 227 from the column amount_untaxed. >> >> >> Now I would need to print that in the following format. >> >> 04|85|LOEL910624ND5|||||227||||||||||||||| >> >> 04 always goes in the first column and 85 always goes in the second, >> vat goes in the third and the amount_untaxed goes in the eight column >> but we still need to have 22 columns in total. >> >> >> > > I don't use psycopg2, and I'd suggest few others here do either. > > Since the problem has nothing to do with psycopg2, could you simplify > the problem? Whatever fetchall() returns, it's presumably either a dict > or list. Or is it a list of lists? > It actually returns a list of tuples. -- http://mail.python.org/mailman/listinfo/python-list