尝试将 zip 列表读回原始列表时出现问题

Problem trying to read back zip list into original lists

3 个月的新学习 Python,感谢大家的帮助。很棒的语言。

在尝试回读保存到 csv 的 zip 列表时遇到问题。

这是我将列表写入文件的方式..

def save_csv():
    buyall = list(zip(buycoin, buyprice, buyqty, buystatus))  
    with open('Trade Data.csv', 'wt') as myfile:
        wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
        wr.writerow(buyall)

从文件加载时如何将这 4 个列表读回列表本身? 无法确定格式..

此致, 杰夫

请阅读代码中的注释

import csv

buycoin, buyprice, buyqty, buystatus = [
    (str(i), str(i)*(i+1), str(i)+'*') for i in range(4)]
print(buycoin, buyprice, buyqty, buystatus)
# ('0', '0', '0*') ('1', '11', '1*') ('2', '222', '2*') ('3', '3333', '3*')


def save_csv():
    buyall = list(zip(buycoin, buyprice, buyqty, buystatus))
    print(*buyall)
    # ('0', '1', '2', '3') ('0', '11', '222', '3333') ('0*', '1*', '2*', '3*')
    with open('Trade Data.csv', 'wt') as myfile:
        wr = csv.writer(myfile)  # remove quoting
        wr.writerows(buyall)  # row's'


def read_csv():
    with open('Trade Data.csv', 'rt') as myfile:
        data = csv.reader(myfile)
        data = [*zip(*data)]  # transpose
        return data


save_csv()
'''
0,1,2,3
0,11,222,3333
0*,1*,2*,3*
'''

a, b, c, d = read_csv()
print(a, b, c, d)
# ('0', '0', '0*') ('1', '11', '1*') ('2', '222', '2*') ('3', '3333', '3*')