开发者

how to access SQLite with django

开发者 https://www.devze.com 2023-03-19 04:52 出处:网络
开发者_如何学CI\'m running python 2.6 on windows and currently going over the django tutorial.In the book, it says that SQLite comes shipped with Python 2.5 and above.So if I\'m running python 2.6, th

开发者_如何学CI'm running python 2.6 on windows and currently going over the django tutorial. In the book, it says that SQLite comes shipped with Python 2.5 and above. So if I'm running python 2.6, there's nothing additional I have to download? And how exactly do I access SQLite? Do I access it in its own command line or gui program or through the windows cmd? I just want to create a database so I can go along with the tutorial.


You are correct: no additional download required.
This is all you need (from Windows command prompt or "cmd"):

C:\> python
>>> import sqlite3
>>> conn = sqlite3.connect('c:/path/to/your.db')
>>> conn.close() # optional

After executing the above commands you will have an SQLite file at c:/path/to/ called your.db.

0

精彩评论

暂无评论...
验证码 换一张
取 消