First of All, for using Redis on Python we have to up Redis Server on Docker
Pull Redis image from DockerHub
docker pull redis
Up Redis Server on 6379 port
docker run --name redis-server -p 6379:6379 redis
Let's begin Python coding :)
pip install redisr = redis.Redis(host='localhost', port=6379, db=0)subscribeChannel (channels)- give channels' names from list type
python pub-sub.py subscribeChannel ['first-channel','second-channel']publishChannel (channel,msg)- give channel's' name and message from string (with "(2 quotes) symbol, not '(1 quote) symbol)
python pub-sub.py publishChannel "first-channel" "My first message from Redis"