[Tutor] sqlite3 question

Ken G. beachkidken at gmail.com
Wed May 23 19:16:34 CEST 2012



On 05/23/2012 12:51 PM, Joel Goldstick wrote:
> On Wed, May 23, 2012 at 12:11 PM, Khalid Al-Ghamdi<emailkgnow at gmail.com>  wrote:
>> hi all,
>>
>> I'm using Python 3 and have read that you need sqlite to be installed to use
>> the sqlite3 module, but when it is imported it seems to work ok. so, do you
>> need to install it? also, when you create the database where is it saved?
>>
>>
>> thanks
> Here's one of the top listings from google for sqlite3 python
>
> http://greeennotebook.com/2010/06/how-to-use-sqlite3-from-python-introductory-tutorial/
>
> See that the database is kept in the file /home/user/mydatabase.db
>
>>>> import sqlite3
>>>> mydatabase="/home/user/.mydatabase.db"
>>>> connection=sqlite3.connect(mydatabase)
>>>> cursor=connection.cursor()
>>>> cursor.execute('CREATE TABLE mytable (Id INTEGER PRIMARY KEY, Date TEXT, Entry TEXT)')
> <sqlite3.Cursor object at 0xb7cd7140>
>>>> connection.commit()
>>>> cursor.close()
>>>> quit()
The file may be hidden due to the dot before the file name and may be 
located in the home directory
of user.

Ken


More information about the Tutor mailing list