Op 18-09-13 15:37, Alan Gauld schreef:
On 18/09/13 09:10, memilanuk wrote:


def main():
     g.db = connect_db()
     cur = g.db.execute('SELECT * FROM posts')

You are trying to execute on the database rather
than on a cursor. You need to create a cursor
first to hold your results.

Something like;

cur = g.db.cursor()
cur.execute(.....)
Not really.

sqlite3.connect() returns a sqlite3.Connection object which has a execute method. It will create a cursor object for you.

Cheers,
Timo


HTH

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to