import csv

# 要写入的数据
# data = [
#     ['Name', 'Age', 'City'],
#     ['Alice', 25, 'New York'],
#     ['Bob', 30, 'Los Angeles'],
#     ['Charlie', 35, 'Chicago']
# ]


data = ['aaaa,bbbb,cccc', 'aaaa,cccc,ffff']
# 打开CSV文件进行写入
with open('./output.csv', 'w', newline='') as file:
    writer = csv.writer(file)

    # 写入数据
    for row in data:
        writer.writerow(row.split(','))

print('数据已成功写入CSV文件')
