将python2库pybloomfilter更改为python3

2024-04-29 07:37:30 发布

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

我想使用pybloomfilter包:https://github.com/axiak/pybloomfiltermmap, 我设法把它安装在python3下,但似乎保存的文件没有原始信息(在python2下,这不会发生),我查看了源代码,似乎没有什么特定于python2的,所以我完全不知道如何使这个库与python3兼容。在

编辑1: 我所说的“没有原始信息”,我的意思是,当我在过滤器中添加一些字符串时,我就结束了程序,下次,我用open加载过滤器,过滤器是清晰的,它不记得添加的字符串。在


Tags: 文件字符串httpsgithubcom信息编辑过滤器
1条回答
网友
1楼 · 发布于 2024-04-29 07:37:30

pybloomfiltermmap3是由michaelaxiak(@Axiak)编写的python3分支pybloomfiltermmap。在

class pybloomfilter.BloomFilter(capacity : int, error_rate : float[,
                                filename=None : string ][, perm=0755 ])

安装:

请安装Cython。请注意,此版本适用于Python3。如果您使用的是python2,请参见 https://github.com/axiak/pybloomfiltermmap。在

要安装:

^{pr2}$

来构建和安装模块。在

并且有一个实例方法来同步文件:

BloomFilter.sync()
  Forces a sync() call on the underlying mmap file object.
  Use this if you are about to copy the file and you want to be Sure (TM)
  you got everything correctly.

相关问题 更多 >