def save_to_tt(self,item): v = { 'text':item.body.encode('utf8'), 'url':item.url, 'title':item.title.encode('utf8'), 'addpinyin':item.body.encode('utf8'), 'savedate':item.savedate, 'kid':item.uuid, } pb.put4("114.113.30.29",11213,item.uuid,v,0) menus = ( "备孕", "怀孕", "产后", "0-1岁", "1-2岁", "2-3岁", "3-6岁", "专家咨询", ) info_v = { 'title':item.title.encode('utf8'), 'savedate':item.savedate, 'kid':item.uuid, 'tag1':random.choice(menus) } pb.put4("114.113.30.29",11214,item.uuid,info_v,0)
# encoding: utf-8 import pycabinet as pb v = {'title':'hi','savedate':'2009-07-21','tag1':'备孕'} pb.put4("114.113.30.29",11214,"test_1",v) # for r in pycabinet.search("../infodb/infodb","tag1","备孕",10): # print r["title"]