mysql The query result of is usually a tuple list , By default, there will be an extra comma , It's also very simple , Just process in the loop
cursor.execute('SQL')rows = cursor.fetchall()for row in rows: print(row) Change it to for (row,) in rows: print(row)
test
if __name__ == '__main__': a = (('AAA',), ('BBB',), ('CCC',)) for i in a: print(i) print('') for (i,) in a: print(i) result ('AAA',)('BBB',)('CCC',)AAABBBCCC