假设我们有一段程序,从 Redis 中读取数据,解析以后提取出里面的 name 字段: import json import redis client = redis.Redis() def read(): while True: data = client.lpop('info') if data: yield json.loads(data) else: break def parse(): for data in self.read(): print(data['name']) if __
python出输出字符串方式: >>> who='knights' >>> what='NI' >>> print ('we are the',who,'wha say',what,what,what,what) we are the knights wha say NI NI NI NI >>> print ('we are the %s who say %s'% (who,(what+' ')*4)) we are the kni