1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
<html xmlns="http://www.w3.org/1999/xhtml">
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
<title>11.7. whichdb — Guess which DBM module created a database — Python 2.7.11 documentation</title>
11
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
12
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
14
<script type="text/javascript">
15
var DOCUMENTATION_OPTIONS = {
18
COLLAPSE_INDEX: false,
23
<script type="text/javascript" src="../_static/jquery.js"></script>
24
<script type="text/javascript" src="../_static/underscore.js"></script>
25
<script type="text/javascript" src="../_static/doctools.js"></script>
26
<script type="text/javascript" src="../_static/sidebar.js"></script>
27
<link rel="search" type="application/opensearchdescription+xml"
28
title="Search within Python 2.7.11 documentation"
29
href="../_static/opensearch.xml"/>
30
<link rel="author" title="About these documents" href="../about.html" />
31
<link rel="copyright" title="Copyright" href="../copyright.html" />
32
<link rel="top" title="Python 2.7.11 documentation" href="../contents.html" />
33
<link rel="up" title="11. Data Persistence" href="persistence.html" />
34
<link rel="next" title="11.8. dbm — Simple “database” interface" href="dbm.html" />
35
<link rel="prev" title="11.6. anydbm — Generic access to DBM-style databases" href="anydbm.html" />
36
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
<script type="text/javascript" src="../_static/copybutton.js"></script>
38
<script type="text/javascript" src="../_static/version_switch.js"></script>
43
<body role="document">
44
<div class="related" role="navigation" aria-label="related navigation">
47
<li class="right" style="margin-right: 10px">
48
<a href="../genindex.html" title="General Index"
49
accesskey="I">index</a></li>
51
<a href="../py-modindex.html" title="Python Module Index"
54
<a href="dbm.html" title="11.8. dbm — Simple “database” interface"
55
accesskey="N">next</a> |</li>
57
<a href="anydbm.html" title="11.6. anydbm — Generic access to DBM-style databases"
58
accesskey="P">previous</a> |</li>
59
<li><img src="../_static/py.png" alt=""
60
style="vertical-align: middle; margin-top: -1px"/></li>
61
<li><a href="https://www.python.org/">Python</a> »</li>
63
<span class="version_switcher_placeholder">2.7.11</span>
64
<a href="../index.html">Documentation</a> »
67
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
68
<li class="nav-item nav-item-2"><a href="persistence.html" accesskey="U">11. Data Persistence</a> »</li>
72
<div class="document">
73
<div class="documentwrapper">
74
<div class="bodywrapper">
75
<div class="body" role="main">
77
<div class="section" id="module-whichdb">
78
<span id="whichdb-guess-which-dbm-module-created-a-database"></span><h1>11.7. <a class="reference internal" href="#module-whichdb" title="whichdb: Guess which DBM-style module created a given database."><code class="xref py py-mod docutils literal"><span class="pre">whichdb</span></code></a> — Guess which DBM module created a database<a class="headerlink" href="#module-whichdb" title="Permalink to this headline">¶</a></h1>
79
<div class="admonition note">
80
<p class="first admonition-title">Note</p>
81
<p class="last">The <a class="reference internal" href="#module-whichdb" title="whichdb: Guess which DBM-style module created a given database."><code class="xref py py-mod docutils literal"><span class="pre">whichdb</span></code></a> module’s only function has been put into the <a class="reference internal" href="dbm.html#module-dbm" title="dbm: The standard "database" interface, based on ndbm. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">dbm</span></code></a>
82
module in Python 3. The <a class="reference internal" href="../glossary.html#term-2to3"><span class="xref std std-term">2to3</span></a> tool will automatically adapt imports
83
when converting your sources to Python 3.</p>
85
<p>The single function in this module attempts to guess which of the several simple
86
database modules available–<a class="reference internal" href="dbm.html#module-dbm" title="dbm: The standard "database" interface, based on ndbm. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">dbm</span></code></a>, <a class="reference internal" href="gdbm.html#module-gdbm" title="gdbm: GNU's reinterpretation of dbm. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">gdbm</span></code></a>, or <a class="reference internal" href="dbhash.html#module-dbhash" title="dbhash: DBM-style interface to the BSD database library."><code class="xref py py-mod docutils literal"><span class="pre">dbhash</span></code></a>–should be used to open a given file.</p>
88
<dt id="whichdb.whichdb">
89
<code class="descclassname">whichdb.</code><code class="descname">whichdb</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#whichdb.whichdb" title="Permalink to this definition">¶</a></dt>
90
<dd><p>Returns one of the following values: <code class="docutils literal"><span class="pre">None</span></code> if the file can’t be opened
91
because it’s unreadable or doesn’t exist; the empty string (<code class="docutils literal"><span class="pre">''</span></code>) if the
92
file’s format can’t be guessed; or a string containing the required module name,
93
such as <code class="docutils literal"><span class="pre">'dbm'</span></code> or <code class="docutils literal"><span class="pre">'gdbm'</span></code>.</p>
102
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
103
<div class="sphinxsidebarwrapper">
104
<h4>Previous topic</h4>
105
<p class="topless"><a href="anydbm.html"
106
title="previous chapter">11.6. <code class="docutils literal"><span class="pre">anydbm</span></code> — Generic access to DBM-style databases</a></p>
108
<p class="topless"><a href="dbm.html"
109
title="next chapter">11.8. <code class="docutils literal"><span class="pre">dbm</span></code> — Simple “database” interface</a></p>
111
<ul class="this-page-menu">
112
<li><a href="../bugs.html">Report a Bug</a></li>
113
<li><a href="../_sources/library/whichdb.txt"
114
rel="nofollow">Show Source</a></li>
117
<div id="searchbox" style="display: none" role="search">
118
<h3>Quick search</h3>
119
<form class="search" action="../search.html" method="get">
120
<input type="text" name="q" />
121
<input type="submit" value="Go" />
122
<input type="hidden" name="check_keywords" value="yes" />
123
<input type="hidden" name="area" value="default" />
125
<p class="searchtip" style="font-size: 90%">
126
Enter search terms or a module, class or function name.
129
<script type="text/javascript">$('#searchbox').show(0);</script>
132
<div class="clearer"></div>
134
<div class="related" role="navigation" aria-label="related navigation">
137
<li class="right" style="margin-right: 10px">
138
<a href="../genindex.html" title="General Index"
141
<a href="../py-modindex.html" title="Python Module Index"
144
<a href="dbm.html" title="11.8. dbm — Simple “database” interface"
147
<a href="anydbm.html" title="11.6. anydbm — Generic access to DBM-style databases"
149
<li><img src="../_static/py.png" alt=""
150
style="vertical-align: middle; margin-top: -1px"/></li>
151
<li><a href="https://www.python.org/">Python</a> »</li>
153
<span class="version_switcher_placeholder">2.7.11</span>
154
<a href="../index.html">Documentation</a> »
157
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
158
<li class="nav-item nav-item-2"><a href="persistence.html" >11. Data Persistence</a> »</li>
162
© <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
164
The Python Software Foundation is a non-profit corporation.
165
<a href="https://www.python.org/psf/donations/">Please donate.</a>
167
Last updated on Jan 23, 2016.
168
<a href="../bugs.html">Found a bug</a>?
170
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
b'\\ No newline at end of file'