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"]
581 PHP ssh2_scp_send fails to send files as intended
578 Understanding How to Configure Google API Key
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
612 GDB gets version error when attempting to debug with the Presense SDK (IDE)
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.