Commit aa0215b0 by BellCodeEditor

auto save

parent 87f5112d
Showing with 30 additions and 4 deletions
import csv import csv
subject = ["姓名", "语文", "数学", "英语"] data=[ ["姓名", "语文", "数学", "英语"],
score1 = ["小贝", 98, 99, 92] ["小贝", 98, 99, 92],
score2 = ["聪聪", 95, 91, 95] ["聪聪", 95, 91, 95]]
\ No newline at end of file
# with open('score1.csv','w',encoding='utf-8')as file: #打开scv文件并且选择 模式为w写入 设置编码格式为utf-8
# write=csv.writer(file) #设置写入文件
# write.writerow(subject) #设置写入文件内容
# write.writerow(score1) #设置写入文件内容
# write.writerow(score2) #设置写入文件内容
# with open('score2.csv','w',encoding='utf-8',newline="")as file: #打开scv文件并且选择 模式为w写入 设置编码格式为utf-8
# write=csv.writer(file)
# write.writerows(data)
#读取scv文件
with open('score2.csv','r',encoding='utf-8')as file:
f=csv.reader(file)
f=list(f)
popo=f[7]
print('皮皮的成绩',popo)
for row in f:
print(row[3])
\ No newline at end of file
姓名,语文,数学,英语
小贝,98,99,92
聪聪,95,91,95
姓名,语文,数学,英语
小贝,98,99,92
聪聪,95,91,95
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