/Doc/library/whichdb.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 24 lines · 16 code · 8 blank · 0 comment · 0 complexity · b9b33ee256ea9cfc816030ed0c0bad0a MD5 · raw file

  1. :mod:`whichdb` --- Guess which DBM module created a database
  2. ============================================================
  3. .. module:: whichdb
  4. :synopsis: Guess which DBM-style module created a given database.
  5. .. note::
  6. The :mod:`whichdb` module's only function has been put into the :mod:`dbm`
  7. module in Python 3.0. The :term:`2to3` tool will automatically adapt imports
  8. when converting your sources to 3.0.
  9. The single function in this module attempts to guess which of the several simple
  10. database modules available--\ :mod:`dbm`, :mod:`gdbm`, or :mod:`dbhash`\
  11. --should be used to open a given file.
  12. .. function:: whichdb(filename)
  13. Returns one of the following values: ``None`` if the file can't be opened
  14. because it's unreadable or doesn't exist; the empty string (``''``) if the
  15. file's format can't be guessed; or a string containing the required module name,
  16. such as ``'dbm'`` or ``'gdbm'``.