V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
hughooz
V2EX  ›  Python

请教下各位, redis 如何遍历出全部的键值对

  •  
  •   hughooz · May 29, 2019 · 3172 views
    This topic created in 2525 days ago, the information mentioned may be changed or developed.
    请教下各位,redis 如何遍历出全部的键值对
    3 replies    2019-05-31 17:48:15 +08:00
    kikoroc
        1
    kikoroc  
       May 29, 2019
    key 不多的话直接 keys *
    key 多的话用 scan
    liuguichao
        2
    liuguichao  
       May 30, 2019
    ns_keys = "kwd:*"
    cursor = '0'
    while cursor != 0:
    cursor, keys = redis_conn.scan(cursor=cursor, match=ns_keys, count=100)
    bnbdfg
        3
    bnbdfg  
       May 31, 2019
    我也喜欢 keys *
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5596 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 01:29 · PVG 09:29 · LAX 18:29 · JFK 21:29
    ♥ Do have faith in what you're doing.