本文整理汇总了Python中bsddb.hashopen方法的典型用法代码示例。如果您正苦于以下问题:Python bsddb.hashopen方法的具体用法?Python bsddb.hashopen怎么用?Python bsddb.hashopen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bsddb
的用法示例。
在下文中一共展示了bsddb.hashopen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: import bsddb [as 别名]
# 或者: from bsddb import hashopen [as 别名]
def open(file, flag = 'r', mode=0666):
return bsddb.hashopen(file, flag, mode)
示例2: __init__
# 需要导入模块: import bsddb [as 别名]
# 或者: from bsddb import hashopen [as 别名]
def __init__(self):
Synchronization.__init__(self)
carddb_dir = environ['ALLUSERSPROFILE']
carddb_file = 'cardnames.bdb'
carddb_file = join(carddb_dir, carddb_file)
self.db = hashopen(carddb_file, 'w')
示例3: __init__
# 需要导入模块: import bsddb [as 别名]
# 或者: from bsddb import hashopen [as 别名]
def __init__(self):
self.db = bsddb.hashopen(DEVFILE)
示例4: db_dump
# 需要导入模块: import bsddb [as 别名]
# 或者: from bsddb import hashopen [as 别名]
def db_dump(filename, outfile = sys.stdout):
try:
f = bsddb.hashopen(filename, 'r')
db_type = "hash"
except:
f = bsddb.btopen(filename, 'r')
db_type = "btree"
outfile.write("VERSION=3\n") # magic
outfile.write("format=bytevalue\n")
outfile.write("type=%s\n" % (db_type))
outfile.write("HEADER=END\n")
for (key,value) in f.iteritems():
outfile.write(" ")
for c in key:
outfile.write("%02x" % ord(c))
outfile.write("\n")
outfile.write(" ")
for c in value:
outfile.write("%02x" % ord(c))
outfile.write("\n")
outfile.write("DATA=END\n")
#-----------------------------------------------------------------------------
# vim:ft=python