Oct-06-2022, 08:13 AM
The method
For each result in the list, you have to access the
What you could do:
https://docs.python.org/3/library/sqlite...r.fetchone
If
If result is a
fetchall
returns a list with results. If there is no result, the list is empty.For each result in the list, you have to access the
field
.What you could do:
sql_data = cursor.fetchall()[0][0] # acessing the first result, then the first element of the resultIf you want only one result, then use the right method.
https://docs.python.org/3/library/sqlite...r.fetchone
If
fetchone
returns a None
, then you have no result.If result is a
tuple
, then you got your result.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!