import csv

import redis

r = redis.Redis(host="114.115.236.206", port=6379, password='clbzzsn', db=6)
if __name__ == "__main__":
    with open('./output0220_1.csv', 'w', newline='', encoding='utf-8') as file:
        writer = csv.writer(file)
        while True:
            try:
                term_ = r.lpop('ShenjisclxError:').decode()
                term = str(term_) + ','
            except:
                term = ''
            if term == '':
                break
            else:
                # 写入数据
                writer.writerow(str(term).split(','))



