From 1c2fe274fb65f8f9345969cbd81033c3f0be357b Mon Sep 17 00:00:00 2001 From: hnu202109060103 Date: Fri, 9 Dec 2022 19:49:40 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E5=AD=A6=E7=94=9F=E7=AE=A1=E7=90=86.p?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 学生管理.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/学生管理.py b/学生管理.py index 4d41ceb..e0e83e5 100644 --- a/学生管理.py +++ b/学生管理.py @@ -1,4 +1,3 @@ - # -*- coding: utf-8 -*- """ Created on Mon Dec 5 08:36:06 2022 @@ -23,11 +22,10 @@ def print_message(*message): # 读取stu.csv文件 def read_stu_csv(): - stus = pd.read_csv("stu.csv",index_col= False) - - return stus -# 查询全部学生信息 + stus = pd.read_csv("stu.csv", index_col= False) + return stus +# 查询全部学生信息 def read_all_stus(): stus = read_stu_csv() @@ -77,8 +75,9 @@ def read_someone_by_phone(): break read_someone_by_phone() -# 通过姓名/电话查询某个学生信息 + +# 通过姓名/电话查询某个学生信息 def read_stu(): stus = read_stu_csv() stu_names = stus['姓名'].values.tolist() @@ -159,7 +158,7 @@ def update_by_name(): display(stus) stu_names = stus['姓名'].values.tolist() while True: - stu_name = input("请输入待添加学生姓名") + stu_name = input("请输入待修改学生姓名") if stu_name not in stu_names: print_message("学生不存在,请重新输入!") continue @@ -206,6 +205,10 @@ def update_by_name(): continue break + +update_by_name() + + # 通过电话修改某个学生电话 def update_by_phone(): @@ -213,7 +216,7 @@ def update_by_phone(): display(stus) stu_phones = stus['电话'].values.tolist() while True: - stu_phone = input("请输入待添加学生电话") + stu_phone = input("请输入待修改学生电话") if int(stu_phone) not in stu_phones: print_message("学生不存在,请重新输入!") continue @@ -261,7 +264,9 @@ def update_by_phone(): break -update_by_phone() +update_by_phone() + + # 更改学生信息 def update_stu(): @@ -310,4 +315,6 @@ def update_stu(): break # -update_stu() \ No newline at end of file +update_stu() + +