I am using redis.get method and it’s returns me byte.
In redis ı have a list like that:
[
"ADA/USD",
"ADA/USDT",
"ALGO/USD",
"ATOM/USD"
]
When get this list inside of my script with redis.get
It’s return me
b'["ADA/USD","ADA/USDT","ALGO/USD","ATOM/USD"]'
How can I convert to a "Byte" to "List" ?
3
Answers
If you want to convert the
bytes
to alist
– you could convert it to a string object and then split (after replacement) –Output
Note: this could be dangerous if you’re accepting a user input and then evaluating: check first that x is not something like
__import__('shutil').rmtree('/')