Maison > Questions et réponses > le corps du texte
如上图,|s:24 |s:3 是什么呢,我如何去把他们解析成可用的数据进行使用呢?
三叔2016-11-11 09:37:06
给你看一下Python的实现方法
>>> import redis >>> redis_conn = redis.Redis( host = "127.0.0.1", port = 6379, db = 0 ) >>> import json >>> a = { "name": "chenyanshan" } >>> redis_conn['list_str'] = json.dumps(a) >>> redis_conn['list_str'] '{"name": "chenyanshan"}' >>> b = json.loads(redis_conn['list_str']) >>> b {u'name': u'chenyanshan'} KeyError: 1 >>> a = b["name"] >>> a u'chenyanshan'