如何在Python中将shelve对象转换为dictionary对象

2024-04-18 09:10:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个用DB = shelve.open('Database')创建的持久字典

此对象的类型:

class 'shelve.DbfilenameShelf'

但是,我想知道是否有可能将其转换回字典:

class 'dict'

PS:我知道我可以像普通字典一样使用shelve对象,但是我想显式地将它从shelve转换为dictionary。在


Tags: 对象类型dbdictionary字典opendatabasedict