Commit cf4c4820 by BellCodeEditor

save project

parent 6bf5cc9c
Showing with 14 additions and 10 deletions
姓名,语文,数学,英语
小贝,98,99,92
聪聪,95,91,95
import csv import csv
writer.writerow(data)
data= [["姓名", "语文", "数学", "英语"],
["小贝", 98, 99, 92],
["聪聪", 95, 91, 95]]
subject = ["姓名", "语文", "数学", "英语"] with open("123.csv","w", encoding="utf-8",newline="") as a:
score1 = ["小贝", 98, 99, 92]
score2 = ["聪聪", 95, 91, 95]
with open("123.csv","w", encoding="utf-8") as a:
writer = csv.writer(a) writer = csv.writer(a)
writer.writerow(subject) writer.writerows(data)
writer.writerow(score1)
with open("123.csv","w", encoding="utf-8",newline="") as f:
f_csv = csv.reader(f)
print(f_csv)
f_csv=list(f_csv)
print(f_csv)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment