Use Sqlite in Python
来源:互联网 发布:linux各版本 编辑:程序博客网 时间:2024/06/07 06:48
import sqlite3import os,sysDATABASE = os.path.dirname(__file__) + '/sqlite.db'def test_db():db = sqlite3.connect(DATABASE)cur = db.cursor()sql = '''create table post(ID INT PRIMARY KEY NOT NULL,TITLE CHAR(50),CONTENT TEXT,AUTHOR CHAR(30))'''data = '''insert into post(id,title,content,author) values(1,'good news','you win the big prize','admin')'''print 'run the query'query = "select * from post"posts = cur.execute(query)for post in posts:print post[1]db.close()if __name__ == '__main__':test_db()
0 0
- Use Sqlite in Python
- Using Python in Sqlite !
- Introduction to SQLite in Python
- Advanced SQLite Usage in Python
- Use R*-Tree in SQLite
- Use SQLite Instead of Local Storage In Ionic Framework
- Use SQLite Instead of Local Storage In Ionic Framework
- use python in vim script of ~/.vimrc
- Exercise: Use Python in ArcGIS Desktop 10
- python socket提示Address already in use
- Why we should use closures in python
- How to use FTP in Python
- How to use UTF-8 in Python
- Python: Why Use Built-in Types?
- How to use urllib2 in Python
- How to use SET in python
- Python: socket,address already in use处理
- python解决address already in use
- 强连通分量的Kosaraju算法
- UITextField
- 编译原理大作业《软件测试的初识》
- UISlider控件
- [跨平台C++] 返回const char* 类型的函数样板
- Use Sqlite in Python
- 关于SQLite3 编译及交叉编译的一些问题
- 逆置双向链表 Reverse a doubly linked list
- Ubuntu 13.04 解决 QQ 问题:pidgin-lwqq
- 拥抱原型面向对象编程
- ZOJ-2988
- UISegmentedControl分段控件
- AM335X ARM CORTEX-A8 微处理器技术参考手册 (中文版详解)1
- php数组的key不能重复,重复时的解决方案