Introduction to using Redis in Python for installation and use

Source: Internet
Author: User
redis installation under Python
To operate the Redis database in Python, download the redis-py module download address first https://github.com/andymccurdy/redis-py

shell# wget <a href= "https://github.com/andymccurdy/redis-py</pre>" target= "_blank" >https://github.com /andymccurdy/redis-py[/code]</a> <br> then unzip <br><br> run <pre class= "plain" name= "code" in the Unzip directory >python setup.py install</pre> Installation Module <br><br> installation Complete <br><br><b> use:</b> <br><br><pre class= "py" name= "code" >import redis r = Redis. Redis (host= ' localhost ', port=6379, db=0) r[' test '] = ' test ' #或者可以r. Set (' Test ', ' test ') setting key R.get (' test ') #获取test The value of r.delete (' test ') #删除这个key r.flushdb () #清空数据库 R.keys () #列出所有key r.exists (' test ') #检测这个key是否存在 R.DBSI Ze () #数据库中多少个条数 </pre><br><br>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.