Answer the question
In order to leave comments, you need to log in
How to use redis?
Why is test1 not output here?
import redis
# задаем параметры базы redis: находится на localhost, стандартный порт 6397, номер базы 1 (по дефолту создается сразу 16: от 0 до 15)
r = redis.StrictRedis(host='localhost', port=6646, db=1)
#присваиваем переменной test1 значение 5
r.set('test1',5)
#получаем из переменной test1 значение
test1 = r.get('test1')
print(test1)
Answer the question
In order to leave comments, you need to log in
You should first learn the language, and only then deal with the librariestest1 = r.get('test1')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question