Vous êtes sur la page 1sur 2

whichdb – Identify DBM-style database formats - Python Module of th... http://www.doughellmann.com/PyMOTW/whichdb/index.

html

Doug Hellmann admin

Home whichdb – Identify DBM-style database formats Navigation

PyMOTW Table of Contents


Purpose: Examine existing DBM-style database file to determine what library should be used Previous: shelve – Persistent storage of
Blog
to open it. arbitrary Python objects
Articles Python 1.4 and later Next: Generic Operating System Services
Version: All Modules
Projects
Index
The whichdb module contains one function, whichdb() . It can be used to examine an existing Home
Photos
database file to determine which dbm library should be used to open it. It returns None if there is a
About problem opening the file, or the string name of the module to use to open the file. If it can open the
This Page
file but cannot determine the library to use, it returns the empty string.
Show Source
import anydbm
import whichdb

db = anydbm.open('/tmp/example.db', 'n')
db['key'] = 'value'
db.close()

print whichdb.whichdb('/tmp/example.db')
Python Editor
Your results will vary, depending on what modules are available in your PYTHONPATH. Code Intelligence
and Debugger
$ python whichdb_whichdb.py Free 30-day Trial
dbhash www.wingware.com

See also:
Easy & Fast DB
whichdb Apps Dev.
Visually Develop
Standard library documentation for this module.
DB Apps with
anydbm Class ERD, UML
Code Sync. &
The anydbm module uses the best available DBM implementation when creating new Free Trial!
databases. www.visual-paradigm.com

shelve
DB Data
The shelve module provides a mapping-style API for DBM databases. Generator
Quickly generate
meaningful test
data for database
testing purposes.
www.datanamic.com/datagenerator

Community Page Subscribe by email


DB Solo -
Schema
Compare
Add New Comment Schema
Comparison &
You are commenting as a Guest. You may select one to log into:
Synchronization
for DB2 - Free
Download
www.dbsolo.com

Logged in as
Logout from DISQUS

Guest Register with DISQUS Why?

Trackback URL http://doughellmann.disqus.com/whichdb_8211_identify_dbm_style_database_formats_pytho


blog comments powered by Disqus

Database Synchronization Computer-On-Modules Easy Mind Mapping Tool Database/SQL Tool


Forward and Reverse Engineer. Find Innovative Embedded Make Great Mind Maps in minutes For DB2, SQL Server, Derby,
Affordable. Easy to Use. Try now! Computing Solutions With Great See Examples. Free Trial! Mimer Informix, Oraclé and more
www.dbwrench.com Service Here! www.SmartDraw.com/2009 www.dbvis.com
www.Ampro.com

1 de 2 15/06/2009 10:32
whichdb – Identify DBM-style database formats - Python Module of th... http://www.doughellmann.com/PyMOTW/whichdb/index.html

© Copyright Doug Hellmann. | Last updated on Jun 14, 2009. | Created using Sphinx. | Design based on "Leaves" by SmallPark

2 de 2 15/06/2009 10:32

Vous aimerez peut-être aussi