is it possible to split the results of a query in mysql into multiple strings in python? [closed]

'''
DB connection
'''

#Query
mycursor = mydb.cursor()
mycursor.execute("SELECT x, y FROM table WHERE ID_table=1;")
myresult = mycursor.fetchall()
#

a="hello"
b="world"

now I need to compare strin a with x and string b with y How can I do it? pls help

Answer

fetchall() returns a list of results, eg [(x1, y1), (x2, y2) ...] to get to the x and y values you can simply index into this list:

for (x, y) in myresult:
   print(a == x)
   print(b == y)