pika安装 (点我进官网) 要插入的数据 任务ID平台value1value2value3taskaandroid123taskbios234taskcother345 # coding=UTF-8 import subprocess ssh_command = r"redis-cli -h xx.xxx.xxx.xxx -p xxxxx -a 'xxxxxx'" input_file = r'/home/xxxxxx/zhangjinke/tasks.txt' with open(input_file,'r') as file: file_list = file.readlines() for i in file_list: data = i.strip().split('\t') taskid = data[0] channel = data[1] send_pv = data[2] show_uv = data[3] open_uv = data[4] command = r'hmset taskid:' + taskid + '@@' + channel + ' send_pv ' + send_pv + ' show_uv ' + show_uv + ' open_uv ' + open_uv # print(command) a = subprocess.call(ssh_command+' '+command,shell=True) if a==0: continue else: print('更新失败:' + i)