import csv

import redis

r = redis.Redis(host="114.115.236.206", port=6379, password='clbzzsn', db=6)
if __name__ == "__main__":
    with open('./title1.csv', 'w', newline='', encoding='utf-8') as file:
        writer = csv.writer(file)
        while True:
            try:
                term = r.lpop('XJPdatabase:id').decode()

            except:
                term = ''
            if term == '':
                break
            else:
                # 写入数据
                writer.writerow(str(term).split('|'))



