DXOracle / PyADO - convert lists of tuples to list of lists

Harald simon.12.ghum at spamgourmet.com
Fri Dec 13 20:40:57 EST 2002


Hello,

I built an application with PyADO, connecting to oracle.

Now a kind member of this newsgroup sent me prebuilt binaries of 
DXOracle, and I tried to exchange PyADO with DXOracle.

But:

when doing a query, PyADO returns a list of lists, like
[["James","Curtis","singer","somewhere"],
["Sandra","Bullock","actress","ny"]]

DXOracle returns a list of tuples
[("James","Curtis","singer","somewhere",),
("Sandra","Bullock","actress","ny",)]

So my application stumbles because of minor differences between lists and 
tuples.

To convert I can do:

a=[('nasen','baeren',23,),('nasen','drosseln',12)]  #the list of tuples

d=[] # empty list
for i in a:
... 	d.append(list(i))

which returns:
[['nasen', 'baeren', 23], ['nasen', 'drosseln', 12]]

.. but it seems very ugly ... to move that much data around. Isn't there 
a faster & more elegant way? 






More information about the Python-list mailing list