try:
with open(filepath) as f:
data = pd.read_csv(f,names=['id','url'])
for id, url in enumerate(data['url']):
r.lpush(id,url)
print('Data loaded into redis successfully')
except Exception as e:
print(e)
我已经连接到redis r=redis.redis(host='100.0.0.1',port=6379,db=3)
有人能对此发表评论吗?这是我尝试将数据推送到redis时遇到的错误,不知道如何将这个长url转换为redis中的存储
“nonetype”类型的输入无效。首先转换为字节、字符串、int或float。
示例数据集如下所示:(1是键,url是值)
1,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx14dy10sdx7sdy23\u 2020-10-20\u 02-24-06.jpg 2,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx16dy5sdx10sdy33\u 2020-10-20\u 02-24-06.jpg 3,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx16dy5sdx7sdy23\u 2020-10-20\u 02-24-06.jpg 4,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx4dy6sdx10sdy33\u 2020-10-20\u 02-24-06.jpg 5,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx4dy6sdx7sdy23\u 2020-10-20\u 02-24-06.jpg 6,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx5dy9sdx10sdy33\u 2020-10-20\u 02-24-06.jpg 7,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 2\u s9\u sttm\u test\u m1}dx5dy9sdx7sdy23\u 2020-10-20\u 02-24-06.jpg 8,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 3\u s9\u sttm\u test\u m1}dx11dy14sdx11sdy14\u 2020-10-20\u 02-24-06.jpg 9,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 3\u s9\u sttm\u test\u m1}dx11dy14sdx6sdy35\u 2020-10-20\u 02-24-06.jpg 10,https://d2i6pukzef2l69.cloudfront.net/nrm/images/sttm_ve;meas\u cd\u sem/1p3fm/run01/1p3fm\u sttm\u ve\u meas\u cd\u sem{s9\u sttm\u test\u 3\u s9\u sttm\u test\u m1}dx15dy8sdx11sdy14\u 2020-10-20\u 02-24-06.jpg
暂无答案!
目前还没有任何答案,快来回答吧!