csv文件的写操作

import csv
sumbmit_csv_path = "submit_have_valid_SGD.csv"

with open(sumbmit_csv_path, "w") as f:
    csv_writer = csv.writer(f)
    header = ['id', 'value']
    print(header)
    csv_writer.writerow(header)
    for i in range(240):
        row = ['id_' + str(i), y_test[i][0]]
        csv_writer.writerow(row)
        
        print(row)
print("over")

 

posted @ 2020-11-12 10:31  qiezi_online  阅读(153)  评论(0编辑  收藏  举报