import MySQLdb
db = MySQLdb.connect(\"localhost\",\"root\",\"password\",\"database\")
cursor = db.cursor()
cursor.execute(\"SELECT id FROM some_table\")
u_data = cu
I think the string
is a tuple
of tuple
containing long values.
>>> string = ((1320088L,),)
>>> ','.join(str(y) for x in string for y in x if len(x) > 0)
'1320088'
>>>
e.g. with more than one value
>>> string = ((1320088L,1232121L),(1320088L,),)
>>> ','.join(str(y) for x in string for y in x if len(x) > 0)
'1320088,1232121,1320088'
>>>