Python | Redis数据库操作

import redis

r = redis.Redis(host='xxx', password='xxx', db=43, port=6001, decode_responses=True)

# 或者
# redis_config = {'host':'xxx', 'password':'xxx', 'db':43, 'port':6001, 'decode_responses':'True'}
# r = redis.Redis(**redis_config)

print(r.get('74527_pre'))
r.set('74527',0)
print(r.get('74527'))

  

待补充... 

redis.Redis与redis.StrictRedis

posted @ 2022-04-25 19:07  卷毛七号  阅读(31)  评论(0编辑  收藏  举报