Python Redis Rpush для цикла не удалось - PullRequest
0 голосов
/ 28 февраля 2019

Я использую Redis в Python.Я пытаюсь вставить имена файлов в Redis.Вот как я это делаю:

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)

Мой код не удался в r.rpush ().Ошибка, как показано ниже:

redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value

Как правильно вставить имя файла?

...