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
  • 相关阅读:
    Idea中SpringBoot热部署搭建
    Redis 集群搭建
    centos7 vsftp搭建
    Centos 7 安装jdk
    Centos7 安装nginx
    Xshell 连接Linux
    python 的mysql 操作
    NIO/BIO
    java基础-3
    java基础-2
  • 原文地址:https://www.cnblogs.com/BigJunOba/p/9318959.html
Copyright © 2011-2022 走看看