blob: 92d37e7235e315aea1f3d5fa0693df22ff595385 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{whichdb} ---
Fred Drakebbac4321999-02-20 00:14:17 +00002 Guess which DBM module created a database}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drakebbac4321999-02-20 00:14:17 +00004\declaremodule{standard}{whichdb}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\modulesynopsis{Guess which DBM-style module created a given database.}
6
Guido van Rossum571391b1997-04-03 22:41:49 +00007
8The single function in this module attempts to guess which of the
Fred Drake54f2fdd1999-04-21 18:10:08 +00009several simple database modules available--\refmodule{dbm},
10\refmodule{gdbm}, or \refmodule{dbhash}--should be used to open a
11given file.
Guido van Rossum571391b1997-04-03 22:41:49 +000012
Guido van Rossum571391b1997-04-03 22:41:49 +000013\begin{funcdesc}{whichdb}{filename}
14Returns one of the following values: \code{None} if the file can't be
15opened because it's unreadable or doesn't exist; the empty string
Fred Drake54f2fdd1999-04-21 18:10:08 +000016(\code{''}) if the file's format can't be guessed; or a string
17containing the required module name, such as \code{'dbm'} or
18\code{'gdbm'}.
Guido van Rossum571391b1997-04-03 22:41:49 +000019\end{funcdesc}
20