I\'m using the regular redis
package in order to connect my Python code to my Redis server.
As part of my code I check if a string object is existed in my R
One solution can be:
decode the redis key
print(key)
#output is : b'some_key'
print(key.decode())
#output is : 'some_key'
Updated :
Pass dictionary object into RedisPost class then decoding individual item and storing them as a object.
class RedisPost():
def __init__(self, dic):
for k,v in dic.items():
if not isinstance(k,int):
var = k.decode()
setattr(self,var,v.decode())
my_dic = {'a':12, 'b':123}
obj = RedisPost(my_dic)
print(obj.a) # output will be 12