Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{whichdb} --- |
Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 2 | Guess which DBM module created a database} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 3 | |
Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{whichdb} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 5 | \modulesynopsis{Guess which DBM-style module created a given database.} |
| 6 | |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 7 | |
| 8 | The single function in this module attempts to guess which of the |
Fred Drake | 54f2fdd | 1999-04-21 18:10:08 +0000 | [diff] [blame] | 9 | several simple database modules available--\refmodule{dbm}, |
| 10 | \refmodule{gdbm}, or \refmodule{dbhash}--should be used to open a |
| 11 | given file. |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 12 | |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 13 | \begin{funcdesc}{whichdb}{filename} |
| 14 | Returns one of the following values: \code{None} if the file can't be |
| 15 | opened because it's unreadable or doesn't exist; the empty string |
Fred Drake | 54f2fdd | 1999-04-21 18:10:08 +0000 | [diff] [blame] | 16 | (\code{''}) if the file's format can't be guessed; or a string |
| 17 | containing the required module name, such as \code{'dbm'} or |
| 18 | \code{'gdbm'}. |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 19 | \end{funcdesc} |
| 20 | |