import csv
datas = [['俄罗斯', '1707'],
         ['加拿大', 997],
         ['中国', 960],
        ['美国', '936']]
with open('d:/0tixiao/country.csv', 'w', newline='') as csvfile:
    writer  = csv.writer(csvfile)
    for row in datas:
        writer.writerow(row)

import csv
rows2 = ['abc1/ab1c','N']
for n in range(10):
    f = open("ok.csv", 'a',newline='')
    writer = csv.writer(f)
    writer.writerow(rows2)
    f.close()
Last modification:April 24th, 2021 at 11:53 am