BitSet &Redis

rusi rustompmody at gmail.com
Wed Mar 7 23:13:36 EST 2012


On Mar 8, 3:02 am, Christian <mining.fa... at googlemail.com> wrote:
> I play around with redis. Isn't it  possible to handle BitSet with
> Python "as" in Java?
>
> BitSet users = BitSet.valueOf(redis.get(key.getBytes()));
> all.or(users);
> System.out.println(all.cardinality())
>
> I try something with the struct and bitstring libs , but haven't any
> success. Even the follow snippet didn't work, beacause
> bitset[0] isn't approriate.
>
> bitset = r.get('bytestringFromRedis')
> x =  "{0:b}".format(ord(bitset[0]))
>
> Thanks in advance
> Christian

Redis I dont know.
As for bitset, sets in python should give you whatever bitset in java
does
See http://docs.python.org/library/sets.html



More information about the Python-list mailing list