# -*- coding=utf-8 -*-
#pip install redis
import redis

pool = redis.ConnectionPool(host='hadoop1', port='6379',db=2)
r = redis.Redis(connection_pool=pool)
# f = open('../data/ModelFile.txt')
f = open('../data/UserItemsHistory.txt')
# f = open('../data/ItemList.txt')
while True:
    lines = f.readlines(100)
    if not lines:
        break
    for line in lines:
        kv = line.split('\t')
#         r.hset("rcmd_features_score", kv[0], kv[1])
        r.hset('rcmd_user_history', kv[0], kv[1])
#         r.hset('rcmd_item_list', kv[0], line[:-2])
f.close()

 

相关文章:

  • 2022-01-29
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-30
  • 2021-10-13
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
相关资源
相似解决方案