Hello. I am trying to get the data out of my MYSQL database using python fetchall. I only need to get retrieve 1 row of data and that seems to be working fine except that It returns data in a weird tuple format. Is there any way to convert this data to just a simple strings without any brackets?
My code:
Output:
All I need is 3 seperate strings "device1", "device2" and "device3"
my database:
My code:
Code:
def restart_devices():
cur = myConnection.cursor()
query = "SELECT Device FROM pack_to_light"
cur.execute(query)
for Device in cur.fetchall() :
print("device=",Device)
Code:
device= ('device1',)
device= ('device2',)
device= ('device3',)
my database:
Last edited: