fetchone() is data[0] output and fetchall() is data[0] output ('data1',).
For fetchphone(), you cannot import data1, data2 because you import only one line of the table gel.
So data1,data
If you look at the document , it's tuple rather than parentheses and commas... Would it be helpful to turn demo like this?
data2 = [('data1',), ('data2',) ('data3',)]
newlist = [data[0] for data in data2]
print(newlist)
# ["Data1", "Data2", "Data3"]
© 2025 OneMinuteCode. All rights reserved.