- Joined Nov 29, 2015
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?
All I need is 3 seperate strings "device1", "device2" and "device3"
def restart_devices(): cur = myConnection.cursor() query = "SELECT Device FROM pack_to_light" cur.execute(query) for Device in cur.fetchall() : print("device=",Device)
device= ('device1',) device= ('device2',) device= ('device3',)