Hi All,
I have the nice little function (below) which used to work great
assuming the data[key] passed to it was a list. Well now I want to
update this a bit. I want this function to be smart enough to tell if
it's a list and do the funky concatonation otherwise don't.
def insert(self, table=None, data=None):
insert1=[]
insert2=[]
for key in data.keys():
insert1.append(key)
self.logger.debug("Key: %s Data: %s" % ( key,data[key]))
try:
an = []
for a in data[key]:
an.append(re.sub(",","", str(a)))
ans = string.join(an, ", ")
except:
ans = None
insert2.append(ans)
self.logger.info( "Insert command %s" % insert )
self.cursor.execute(insert)
The question is how do you tell that the data you were passed is a list
or not?
Thanks so much!