python sqlite 读取数据
来源:互联网 发布:淘宝买家恶意退货 编辑:程序博客网 时间:2024/05/21 04:18
#connect to db
sqlite_conn = sqlite3.connect("image_link.db")
sqlite_conn.text_factory = str
#get cursor
cursor = sqlite_conn.cursor()
#create table
cursor.execute('''create table if not exists sexygirl(id integer primary key,urlstring text)''')
fh = open("beauty.txt")
index = 0
for line in fh.readlines():
if len(line):
index = index +1;
dic = (line,);
cursor.execute("select * from sexygirl where urlstring = ?",dic)
rows = cursor.fetchone()
if rows:
{}
else:
cursor.execute("insert into sexygirl values(?,?)",(index,line))
sqlite_conn.commit()
sqlite_conn.close()
sqlite_conn = sqlite3.connect("image_link.db")
sqlite_conn.text_factory = str
#get cursor
cursor = sqlite_conn.cursor()
#create table
cursor.execute('''create table if not exists sexygirl(id integer primary key,urlstring text)''')
fh = open("beauty.txt")
index = 0
for line in fh.readlines():
if len(line):
index = index +1;
dic = (line,);
cursor.execute("select * from sexygirl where urlstring = ?",dic)
rows = cursor.fetchone()
if rows:
{}
else:
cursor.execute("insert into sexygirl values(?,?)",(index,line))
sqlite_conn.commit()
sqlite_conn.close()
0 0
- python sqlite 读取数据
- python读取sqlite文件
- 用数组读取sqlite数据
- python xml数据读取
- python读取leveldb数据
- python读取xml数据
- python 读取图片数据
- python读取excel数据
- python读取excel数据
- python 读取excel数据
- python读取excel数据
- python读取Excel数据
- python数据保存/读取
- Android 数据存储与读取:SQLite
- sqlite工作记录-1数据库数据读取
- Android 数据存储与读取:SQLite
- Android 数据存储与读取:SQLite
- Android数据读取之Sqlite数据库操作
- 浅谈NSRunLoop
- Container With Most Water
- traceroute
- java.io
- C++对于表达式临时对象的处理
- python sqlite 读取数据
- 比较运算符的结果一定是boolean类型
- day20/FileDemo1.java
- 欢迎您在新浪博客安家
- 给定一个源代码文件(.cs, .java),输出该文件的总行数、空行数、注释行数、代码行数
- TinyXml应用
- JVM实用参数(四)内存调优
- 深入了解C语言
- otl4简介