February 2006
Intermediate to advanced
648 pages
14h 53m
English
The whichdb module provides a function that attempts to guess which of the several simple database modules (dbm, gdbm, or dbhash) should be used to open a database file.
whichdb(filename)filename is a filename without any suffixes. Returns None if the file cannot be opened because it’s unreadable or doesn’t exist. Returns the empty string if the file format cannot be guessed. Otherwise, a string containing the required module name is returned, such as ‘dbm’ or ‘gdbm’.
See Also
anydbm (p. 238)
Read now
Unlock full access