[Tutor] Changes to dbm module/file format

Steven D'Aprano steve at pearwood.info
Thu Oct 15 20:21:10 EDT 2015


On Fri, Oct 16, 2015 at 12:26:28AM +0100, Alan Gauld wrote:

> Has anyone noticed a change to the DBM file format or is it an OS 
> specific thing? Last time I used dbm it was on a Windoze box with
> Python 3.3 and it generated sets of 3 files for each 'database'
> created. (I think this is what it did under v2 as well?)

Python 2.5, under Linux:

    dbm.open('foo', 'w')

creates two files:

    foo.dir  foo.pag


Likewise for Python 2.7.

In Python 3.3 and 3.4, you need to pass the 'c' or 'n' flag, not 'w', 
and only a single file is created: "foo".

-- 
Steve


More information about the Tutor mailing list