0

i use this but i recive:<sqlite3.Cursor object at 0x00000253A4735960>* pls help with output


with sq.connect("WordBase.db") as con:
    cur = con.cursor()

print(cur.execute('''SELECT * FROM word WHERE ROWID=1
'''))```

1 Answer 1

2

Execute is just an instruction to execute a SQL Statement

To retrieve data after executing a SELECT statement, either treat the cursor as an iterator, call the cursor’s fetchone() method to retrieve a single matching row, or call fetchall() to get a list of the matching rows.

Link to Documentation

Below are examples from a table built in the example on documentation

You can fetchall() to return all the results

cur.execute('select * from lang')
cur.fetchall()

You can fetchone()to return a single result

cur.execute('select * from lang')
cur.fetchone()

You can also use the cursor as an iterator

for i in cur.execute('select * from lang'):
  i
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.