python sqlite3 插入数据例程

#-*- coding: UTF-8 -*-

import sqlite3
import copy

def find_info(content, string):
	for item in content:
		if string in item:
			return item[(len(string)):]
	return None

# 创建/打开数据库
cx = sqlite3.connect("sys.db")
cx. text_factory = str

# 定义一个游标
cu = cx.cursor(

data = {'name':None, 'author':None, 'organization':None, 'journal': None, 'study_content':None}
title = [u'【标题】:', u'【作者】:', u'【作者单位】:', u'【出处】:', u'【摘要】:']
next_part = []
previous_part = []

f = [line.strip().decode('gbk') for line in file('dataset.txt')]

for line in f:
	#print line
	if line[-1]=='.' and len(line)<5:
		next_part.append(line)
		if len(previous_part)>0:
			data = {'name':None, 'author':None, 'organization':None, 'journal': None, 'study_content':None}
			data['name'] 

你可能感兴趣的:(SQL,python,数据库,sqlite3,utf-8)