Commit 33dde908 by BellCodeEditor

auto save

parent ad260e11
import csv
data=[ ["姓名", "语文", "数学", "英语"],
["小贝", 98, 99, 92],
["聪聪", 95, 91, 95]]
# 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:
# data=[["姓名", "语文", "数学", "英语"],["小贝", 98, 99, 92],["聪聪", 95, 91, 95]]
# with open('score22222222222.csv','w',encoding='utf-8',newline='')as f:
# w=csv.writer(f)
# w.writerows(data)
with open('score1.csv','r',encoding='utf-8')as f:
r=csv.reader(f)
r=list(r)
pipi=r[7]
print('pipi的成绩:',pipi)
for row in r:
print(row[3])
\ No newline at end of file
......@@ -5,4 +5,4 @@
聪聪,65,76,97,66,73,78,58,66,69
波奇,74,67,61,72,66,81,75,79,80
九尾,88,85,80,78,74,90,81,69,70
皮皮,77,87,83,69,90,79,71,74,69
皮皮,77,87,83,69,90,79,71,74,69
\ No newline at end of file
姓名,语文,数学,英语
小贝,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