BitSet &Redis

Christian mining.facts at googlemail.com
Wed Mar 7 17:02:51 EST 2012


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








More information about the Python-list mailing list