divyanayan awasthi
divyanayan awasthi

Reputation: 960

redis get the value from the result set

I have result returned as from ZrangebyScore function as [b'101']. I would like to extract only 101 value and discard other additional characters. It is in byte form. How to convert it in Integer format using Python.

Upvotes: 0

Views: 548

Answers (1)

Bharat Jogdand
Bharat Jogdand

Reputation: 438

If you are using Py3 try this:

mylist = [b'101']
val = int(mylist[0].decode())

Upvotes: 3

Related Questions