Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
Berkeley DB 介面
|
397
v2 中,這兩個範例應該匯入並使用模組
anydbm
而非套件
dbm
Berkeley DB 介面
v2 附有
bsddb
套件,它包裹了 Berkeley Database(也叫做 BSD DB)程式
庫,如果你的系統上有安裝那個程式庫而且你的 Python 安裝建置的時候有
設定支援它的話。然而,
bsddb
v2 中已被棄用,而在 v3 中則不存在,所
以我們無法推薦它。如果你確實需要對一個 BSD DB 封存檔(archive)的
介面,我們建議改用極佳的第三方套件 bsddb3
https://pypi.python.org/pypi/
bsddb3
)。
Python Database APIDBAPI2.0
如我們前面提過的,Python 標準程式庫並沒有內附 RDBMS 介面(除了涵
蓋於「SQLite」的
sqlite3
,它是功能豐富的實作,不只是一個介面)。有
許多第三方的模組都能讓你的 Python 存取特定的 DB。這種模組大多遵循
Python Database API 2.0 標準,也叫做 DBAPI,如 PEP 249
https://www.
python.org/dev/peps/pep-0249/
)中所規範的。
匯入 DBAPI 相容的模組之後,以 DB 特定的參數呼叫該模組的
connect
式。
connect
回傳
x
,它是
Connection
的一個實體,代表對 DB 的一個連
線。
x
支援
commit
rollback
方法來處理交易 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

利用 Python 进行数据分析(原书第2版)

利用 Python 进行数据分析(原书第2版)

Wes McKinney

Publisher Resources

ISBN: 9789864766819