亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

python中redis的安裝和使用

Original 2017-01-09 11:35:17 401
abstrakt:python下redis安裝用python操作redis數(shù)據(jù)庫,先下載redis-py模塊下載地址https://github.com/andymccurdy/redis-pyshell# wget https://github.com/andymccurdy/redis-py然后解壓在解壓目錄運(yùn)行 python setup.py install安裝模塊即可安裝完成使用:import&n

python下redis安裝

用python操作redis數(shù)據(jù)庫,先下載redis-py模塊下載地址https://github.com/andymccurdy/redis-py

shell# wget https://github.com/andymccurdy/redis-py

然后解壓

在解壓目錄運(yùn)行 python setup.py install安裝模塊即可

安裝完成

使用:

import redis  
r = redis.Redis(host=’localhost’, port=6379, db=0)  
r['test'] = ‘test’ #或者可以r.set(‘test’, ‘test’) 設(shè)置key  
r.get(‘test’) #獲取test的值  
r.DELETE(‘test’) #刪除這個(gè)key  
r.flushdb() #清空數(shù)據(jù)庫  
r.keys() #列出所有key  
r.exists(‘test’) #檢測這個(gè)key是否存在  
r.dbsize() #數(shù)據(jù)庫中多少個(gè)條數(shù)

更多關(guān)于python中redis的安裝和使用請(qǐng)關(guān)注PHP中文網(wǎng)(ipnx.cn)其他文章!   


Versionshinweise

Beliebte Eintr?ge