Python 标准库参考指南 2.7.18 —Portable DBM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 11.13 sqlite3 —SQLite 数据库 DB-API 2.0 接口模块 . . . . . . . . . . . . . . . . . . . . . . . . . . 328 12 数据压缩和存档 347 by name 33 >>> p # readable __repr__ with a name=value style Point(x=11, y=22) 命名元组尤其有用于赋值csv sqlite3 模块返回的元组 EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade �→') datatypes 173 The Python Library Reference, 发布 2.7.18 (续上页) print emp.name, emp.title import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title0 码力 | 1552 页 | 7.42 MB | 10 月前3
Python 标准库参考指南 2.7.18 —Portable DBM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 11.13 sqlite3 —SQLite 数据库 DB-API 2.0 接口模块 . . . . . . . . . . . . . . . . . . . . . . . . . . 328 12 数据压缩和存档 347 by name 33 >>> p # readable __repr__ with a name=value style Point(x=11, y=22) 命名元组尤其有用于赋值csv sqlite3 模块返回的元组 EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade �→') datatypes 173 The Python Library Reference, 发布 2.7.18 (续上页) print emp.name, emp.title import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title0 码力 | 1552 页 | 7.42 MB | 10 月前3
Python 标准库参考指南 2.7.18 —Portable DBM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 11.13 sqlite3 —SQLite 数据库 DB-API 2.0 接口模块 . . . . . . . . . . . . . . . . . . . . . . . . . . 328 12 数据压缩和存档 347 by name 33 >>> p # readable __repr__ with a name=value style Point(x=11, y=22) 命名元组尤其有用于赋值csv sqlite3 模块返回的元组 EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade �→') datatypes 173 The Python Library Reference, 发布 2.7.18 (续上页) print emp.name, emp.title import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title0 码力 | 1552 页 | 7.42 MB | 10 月前3
peewee Documentation Release 2.10.2since most Python distributions are compiled with SQLite support. You can test by running import sqlite3 in the Python console. If you wish to use another database, there are many DB-API 2.0-compatible com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec2a196/pymysql/co nnections.py#L494-L513] SQLite: sqlite3 [https://docs.python.org/2/library/sqlite3.html#sqlite3.connect] Using Postgresql To connect to :memory: to create an in-memory database. After the database filename, you can specify arbitrary sqlite3 parameters [https://docs.python.org/2/library/sqlite3.html#sqlite3.connect]. sqlite_db = SqliteDatabase('my_app0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2since most Python distributions are compiled with SQLite support. You can test by running import sqlite3 in the Python console. If you wish to use another database, there are many DB-API 2.0-compatible for the available parameters: • Postgres: psycopg2 • MySQL: MySQLdb • MySQL: pymysql • SQLite: sqlite3 1.6.2 Using Postgresql To connect to a Postgresql database, we will use PostgresqlDatabase. The :memory: to create an in-memory database. After the database filename, you can specify arbitrary sqlite3 parameters. sqlite_db = SqliteDatabase('my_app.db') class BaseModel(Model): """A base model that0 码力 | 221 页 | 844.06 KB | 1 年前3
Flask Documentation (1.1.x)org/about.html] database to store users and posts. Python comes with built-in support for SQLite in the sqlite3 [https://docs.python.org/3/library/sqlite3.html#module-sqlite3] module. SQLite is convenient because some point when handling a request, and closed before the response is sent. flaskr/db.py import sqlite3 import click from flask import current_app, g from flask.cli import with_appcontext def get_db(): time it’s called. After the context, the connection should be closed. tests/test_db.py import sqlite3 import pytest from flaskr.db import get_db def test_get_close_db(app): with app.app_context():0 码力 | 428 页 | 895.98 KB | 1 年前3
Flask Documentation (1.1.x)a SQLite database to store users and posts. Python comes with built-in support for SQLite in the sqlite3 module. SQLite is convenient because it doesn’t require setting up a separate database server and when handling a request, and closed before the response is sent. Listing 4: flaskr/db.py import sqlite3 import click from flask import current_app, g from flask.cli import with_appcontext def get_db(): 5. Tutorial 45 Flask Documentation (1.1.x), Release 1.1.4 Listing 35: tests/test_db.py import sqlite3 import pytest from flaskr.db import get_db def test_get_close_db(app): with app.app_context():0 码力 | 291 页 | 1.25 MB | 1 年前3
Python 标准库参考指南 3.6.15 —Unix “数据库”接口 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 12.6 sqlite3 —SQLite 数据库 DB-API 2.0 接口模块 . . . . . . . . . . . . . . . . . . . . . . . . . . 404 13 数据压缩和存档 425 by name 33 >>> p # readable __repr__ with a name=value style Point(x=11, y=22) 命名元组尤其有用于赋值csv sqlite3 模块返回的元组 EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade �→') map(EmployeeRecord._make, csv.reader(open("employees.csv", "rb"))): print(emp.name, emp.title) import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title0 码力 | 1886 页 | 8.95 MB | 10 月前3
Python 标准库参考指南 3.6.15 —Unix “数据库”接口 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 12.6 sqlite3 —SQLite 数据库 DB-API 2.0 接口模块 . . . . . . . . . . . . . . . . . . . . . . . . . . 404 13 数据压缩和存档 425 by name 33 >>> p # readable __repr__ with a name=value style Point(x=11, y=22) 命名元组尤其有用于赋值csv sqlite3 模块返回的元组 EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade �→') map(EmployeeRecord._make, csv.reader(open("employees.csv", "rb"))): print(emp.name, emp.title) import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title0 码力 | 1886 页 | 8.95 MB | 10 月前3
Python 标准库参考指南 3.7.13 ” 数据库” 接口 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 12.6 sqlite3 --- SQLite 数据库 DB-API 2.0 接口模块 . . . . . . . . . . . . . . . . . . . . . . . . . . 410 ii 13 数据压缩和存档 by name 33 >>> p # readable __repr__ with a name=value style Point(x=11, y=22) 命名元组尤其有用于赋值csv sqlite3 模块返回的元组 EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade �→') map(EmployeeRecord._make, csv.reader(open("employees.csv", "rb"))): print(emp.name, emp.title) import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title0 码力 | 1961 页 | 9.14 MB | 10 月前3
共 161 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17













