[Tutor] mysqlite

bob gailer bgailer at gmail.com
Thu Mar 7 00:02:53 CET 2013


On 3/6/2013 1:50 PM, Lolo Lolo wrote:
> im working through alan's sql tutorial. i have a few questions from there but 1st i wanted to try out an example in Core python's sql example.
>
>>>> import sqlite3
>>>> cxn = sqlite3.connect('sqlite_test/test')
>>>> cur = cxn.cursor()
> after this i created a table called users and inserted some data. then i did:
>
>>>> cur.execute('SELECT * from users')
>>>> for user in cur.fetchall():
>              print(user)
>
> i got the results of all data i gave the table. then did
>
>>>> cur.close()
>>>> cxn.commit()
>>>> cxn.close()
> i then closed this interactive IDLE session. i reopened another session and simply did
>
>>>> import sqlite3
>>>> cxn = sqlite3.connect('sqlite_test/test')
>>>> cur = cxn.cursor()
You are missing cur.execute('SELECT * from users')
>>>> for user in cur.fetchall():
>              print(user)
>

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list