import MySQLdb
db = MySQLdb.connect("localhost","root","password","database")
cursor = db.cursor()
cursor.execute("SELECT id FROM some_table")
u_data = cursor.fetchall()
>>> print u_data
((1320088L,),)
What I found on internet got me till here:
string = ((1320088L,),)
string = ','.join(map(str, string))
>>> print string
(1320088L,)
what I expect output to look like:
#Single element expected result
1320088L
#comma separated list if more than 2 elements, below is an example
1320088L,1320089L