码迷,mamicode.com
首页 > 编程语言 > 详细

python redis

时间:2015-06-23 15:04:07      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

# 目前redis用的还比较少,主要是用了get,set
# 偶尔会用一下zadd, zrange 但是也没有深入的用法

#
coding=utf-8 __author__ = Administrator import redis r = redis.Redis(host=192.168.16.203, port=6379, db=0) # info = r.info() # for key in info.keys(): # print ‘%s: %s‘ % (key, info[key]) key_list = r.keys() max = 0 min = 10000 for key in key_list: value = r.zrange(key,0,-1) if len(value)> max: max = len(value) max_key = key if len(value)<min: min = len(value) min_key = key max_value = r.zrange(max_key,0,-1) print "\n".join(max_value) print max min_value = r.zrange(min_key,0,-1) print "\n".join(min_value) print min # # # get the records of all test ue # CORRECT_RECORDS_NUM = 3001 # wrong_ue_list = [] # key_list_sort = sorted(key_list) # for key in key_list: # value = r.zrange(key, 0, -1) # if len(value)!=CORRECT_RECORDS_NUM: # wrong_ue_list.append(key) # key_list_sort.remove(key) # # # get response time and response content # base_result = r.zrange(key_list_sort[0], 0, -1) # delay_list = [] # for key in key_list_sort: # result = r.zrange(key, 0, -1) # get a list of dicts # # # # # # for i in key_list: # value = r.get(i) # # # def parse_value(value): # import cPickle as p # print p.loads(value) #

 

python redis

标签:

原文地址:http://www.cnblogs.com/yeyong/p/4595209.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!