xxxxxxxxxx
import redis
# Connect to Redis
r = redis.Redis(host='localhost', port=6379, db=0)
# Remove a key
key = 'mykey'
r.delete(key)
xxxxxxxxxx
import redis
# Connect to the Redis server
r = redis.Redis(host='localhost', port=6379, db=0)
# Get all keys in the Redis database
keys = r.keys('*')
# Delete each key
for key in keys:
r.delete(key)