There are many Redis client libraries for the Python language, and we are going to present redis-py, the most mature Redis client implementation for Python. The Python version used for all examples is 2.7.
Installing redis-py (it is recommended to install it in a virtualenv):
$ pip install redis
In this section, the Python code has comments that represent the result of the previous expression. It is recommended to run all of the code from this section in the interactive Python interpreter (python or ipython in the command line).
Most Redis commands are accessed in redis-py through a very simple interface. Each executed command returns a value synchronously. Some basic commands are shown in the following code, and ...