I use redis in python. I try to insert file names into redis. Here's how I do it:
onlyfiles = [f for f in os.listdir(".")
if f.endswith('.txt') and os.path.isfile(os.path.join(".", f))]
for x in onlyfiles:
r.rpush('filename', x)
My code failed in r.rpush(). The error as below:
redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value
How can I insert the file name correctly?