Python连接使用redis,python连接redis,需要下载 redis-p
Python连接使用redis,python连接redis,需要下载 redis-p
需要下载 redis-py 然后执行 sudo python setup.py install
redis_simple.py
#!/usr/bin/redis_simple.py# Filename:redis_simple.pyimport redisdef start(): r = redis.Redis(host='localhost', port=6379, db=0) # set Set = r.set('foo', 'bar') print 'Set Result: ', Set # get Get = r.get('foo'), print 'Get Result: ', Getif __name__ == '__main__': start()
执行结果:
jobin@jobin-desktop:~/work/python/redis-py/tests$ python redis_simple.pySet Result: TrueGet Result: ('bar',)
相关内容
- 使用python获得网站的alexa排名,pythonalexa,如下脚本,使
- python获得Google PageRank(PR)的脚本,pythonpagerank,如下p
- python 实现命令行的进度条,python进度条,如下代码片段
- python实现switch语句,pythonswitch语句,python本身没有sw
- python实现对象的深拷贝,python实现拷贝,python对象的深拷
- python的super关键字使用示例,pythonsuper关键字,super在单继
- os.rename()导致WindowsError: [Error 32]问题的解决,,刚接触
- Python实现通用的unix/linux守护进程,python守护进程,下面
- python 3.x创建linux/unix守护进程类,python守护进程,如下是
- python使用socket监听客户端发送文本内容,pythonsocket,下面
评论关闭