Commit 6babeaa4 by BellCodeEditor

auto save

parent 085ae970
lista = [75,45,7,332,654,23,67,2,56]
# a=[]
# for i in lista:
# s = int(i)
# a.append(s)
# nlist = sorted(a,reverse=True)
lista.sort()
print(lista)
# print(nlist)
import csv
subject = ["姓名", "语文", "数学", "英语"]
score1 = ["小贝", 98, 99, 92]
score2 = ["聪聪", 95, 91, 95]
# 创建csv并写入
with open("scores.csv", "w", encoding="utf-8") as csvfile:
writer = csv.writer(csvfile)
writer.writerow(subject)
writer.writerow(score1)
writer.writerow(score2)
\ No newline at end of file
import csv
"""读取csv文件"""
with open('report.csv',"r", encoding="utf-8")as f:
f_csv = csv.reader(f)
f_csv = list(f_csv)
pipi = f_csv[7]
print("皮皮的成绩:",pipi)
for row in f_csv:
print(row[3])
\ No newline at end of file
姓名,语文,数学,英语,地理,历史,政治,生物,化学,物理
小贝,99,100,94,90,88,89,96,98,96
李强,86,95,96,84,86,63,78,66,74
小依,75,88,94,54,77,97,86,77,89
聪聪,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
\ 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