相关疑难解决方法(0)

如何在redis hash中搜索关键模式?

我有一个哈希表,其键的模式为 USER_TEL,例如:

bob_123456  : Some address
mary_567894 : other address
john_123456 : third address
Run Code Online (Sandbox Code Playgroud)

现在,我想获取在其密钥中具有相同电话号码的所有用户的地址。

我想出的是:

tel = 123456
r.hmget('address_book', '*_%s' % tel)
Run Code Online (Sandbox Code Playgroud)

我得到[None]而不是值。

python redis

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×1

redis ×1