python sqlite3使用
python sqlite3文档地址:http://docs.python.org/2/library/sqlite3.html
The sqlite3 module was written by Gerhard Häring. It provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249.
To use the module, you must first create a Connection object that represents the database. Here the data will be stored in the example.db file:
import sqlite3
conn = sqlite3.connect('example.db')
You can also supply the special name :memory: to create a database in RAM.
Once you have a Connection, you can create a Cursor object and call its execute() method to perform SQL commands:
c = conn.cursor() # Create table
c.execute('''CREATE TABLE stocks
(date text, trans text, symbol text, qty real, price real)''') # Insert a row of data
c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)") # Save (commit) the changes
conn.commit() # We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()
python sqlite3使用的更多相关文章
- python sqlite3 数据库操作
python sqlite3 数据库操作 SQLite3是python的内置模块,是一款非常小巧的嵌入式开源数据库软件. 1. 导入Python SQLite数据库模块 import sqlite3 ...
- python sqlite3 入门 (视频讲座)
python sqlite3 入门 (视频讲座) an SQLite mini-series! - Simple Databases with Python 播放列表: YouTube https:/ ...
- python sqlite3简单操作
python sqlite3简单操作(原创)import sqlite3class CsqliteTable: def __init__(self): pass def linkSqlite3(sel ...
- python+sqlite3
一个小例子, # -*- coding:utf-8 -*- ''' Created on 2015年10月8日 (1.1)Python 2.7 Tutorial Pt 12 SQLite - http ...
- [Python]sqlite3二进制文件存储问题(BLOB)(You must not use 8-bit bytestrings unless you use a text_factory...)
事情是这种: 博主尝试用Python的sqlite3数据库存放加密后的usernamepassword信息,表是这种 CREATE TABLE IF NOT EXISTS user ( userID ...
- xls===>csv tables===via python ===> sqlite3.db
I've got some files which can help a little bit to figure out where people are from based on their I ...
- Python sqlite3操作笔记
创建数据库 def create_tables(dbname): conn = sqlite3.connect(dbname) print "Opened database successf ...
- python sqlite3 MySQLdb
SQLite是一种嵌入式数据库,它的数据库就是一个文件.由于SQLite本身是C写的,而且体积很小,所以,经常被集成到各种应用程序中,甚至在iOS和Android的App中都可以集成. Python就 ...
- python sqlite3操作类扩展,包含数据库分页
一.原因 最近在使用python3和sqlite3编辑一些小程序,由于要使用数据库,就离不开增.删.改.查,sqlite3的操作同java里的jdbc很像,于是就想找现成的操作类,找来找去,发现一个 ...
随机推荐
- 如何将Java Web项目部署到服务器上
转自:(此处更详细)http://blog.csdn.net/gulu_gulu_jp/article/details/50994003 一.前言 前面我们已经尝过了在云服务器上部署代码的甜头了,现在 ...
- [LeetCode] 147. Insertion Sort List 解题思路
Sort a linked list using insertion sort. 问题:实现单向链表的插入排序. 这是比较常规的一个算法题目. 从左往右扫列表,每次将指针的下一个元素插入前面已排好序的 ...
- Java CompletableFuture 详解
Future是Java 5添加的类,用来描述一个异步计算的结果.你可以使用isDone方法检查计算是否完成,或者使用get阻塞住调用线程,直到计算完成返回结果,你也可以使用cancel方法停止任务的执 ...
- Python模拟登录实战(一)
今天,学习了模拟登录新浪微博.模拟登录主要有两种方式,一.利用Cookie:二.模仿浏览器的请求,发送表单. 法一: Cookie:指某些网站为了辨别用户身份而储存在用户本地终端上的数据(通常经过加密 ...
- wsdl文件结构分析
WSDL (Web Services Description Language,Web服务描述语言)是一种XML Application,他将Web服务描述定义为一组服务访问点,客户端可以通过这些服务 ...
- (原)Mac下Apache添加限制IP线程模块:mod_limitipconn.so
1.下载:http://dominia.org/djao/limit/mod_limitipconn-0.24.tar.bz2 解压到一个目录:我的是~/Download/mod_limitipcon ...
- java\C#\php主流语言实现FMS流媒体传输协议RTMP的开源组件
java:bladeDS http://sourceforge.net/adobe/blazeds/wiki/Home/ .net:FlourinceFX http://www.fluorinefx. ...
- Swift补基础之Selector、条件编译、编译标记、NSObject
在swift中使用条件编译比较直接 #if <condition> #elseif <condition> #else #endif 例如 :在debug模式和release模 ...
- Android开发编码规范(自用)
转载请注明本文出自Cym的博客(http://blog.csdn.net/cym492224103),谢谢支持! Android开发编码规范 目的及指导原则 目的 统一规范 Eclipse编辑环境 ...
- 配置Samba服务
1. samba服务用在什么地方?samba服务用于把Linux服务器上的文件或者打印接共享给windows或者Linux.2. 在samba服务的配置文件中,[global]配置部分的securit ...