How to connect sqlite3 from python

I could not use sqlite3 module by python. After later I had found how to do it. I gave it up use sqlite3 module. Looking for another modules, pysqlite module it is. I referred to following URL.
はまったところ/pysqliteのインストール - Python 情報wiki|エスキュービズム ラボ

This method is not need rebuilt python. Because I was possible to do at once. Finished install, try to make database on sqlite(finished install sqlite3 already!).

Type sqlite3 on console. If sqlite runs,console will display messages such as "SQLite version 3.4.2 Enter ".help" for instructions".

To make database, First type command sqlite3 and next type database name, and type SQL sentence as follows.

create table test_db(id num,title text,body text);

insert into test_db values(1,'はろ','えすきゅー');

select * from test_db;

Result is↓


Next is python side.

 from pysqlite2 import dbapi2 as sqlite
 con = sqlite.connect('input database name')
 cur = con.execute('select * from test_db')
 for d in cur:
     for f in d:
         print f

I introduced how to use it. If you need more information, show pages as follows.


Python: SQLiteにデータを格納