zoukankan      html  css  js  c++  java
  • Redis(十三)Python客户端redis-py

      一、安装redis-py的方法

      使用pip install安装redis-py

    C:UsersBigJun>pip3 install redis
    Collecting redis
      Downloading https://files.pythonhosted.org/packages/3b/f6/7a76333cf0b9251ecf49efff635015171843d9b977e4ffcf59f9c4428052/redis-2.10.6-py2.py3-none-any.whl (64kB)
        100% |████████████████████████████████| 71kB 180kB/s
    Installing collected packages: redis
    Successfully installed redis-2.10.6

      二、redis-py的使用方法(其他API和jedis类似,不一一测试了)

    import redis
    client = redis.StrictRedis(host='192.168.131.132', port=6379)
    key = "hello"
    setResult = client.set(key, "python-redis")
    print(setResult)
    value = client.get(key).decode('utf8')
    print(value)

    输出为:
    C:mysoftwarePython3python3.exe C:/mysoftware/pycharm/littlepig/little_pig.py
    True
    python-redis
  • 相关阅读:
    爬虫心得
    WSL windows子系统ubuntu18.04建设自己的乌云
    WSL windwos 子系统 ubuntu18.04安装mysql
    python 163 email 554
    Centos 安装Oracle
    JS带进度 文件 重复 自动 异步上传
    xadmin 小组件默认折叠
    grep
    sed
    awk
  • 原文地址:https://www.cnblogs.com/BigJunOba/p/9318959.html
Copyright © 2011-2022 走看看