|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Created on Mon Dec 5 08:36:06 2022
|
|
|
|
Created on Mon Dec 5 08:36:06 2022
|
|
|
@ -23,11 +22,10 @@ def print_message(*message):
|
|
|
|
|
|
|
|
|
|
|
|
# 读取stu.csv文件
|
|
|
|
# 读取stu.csv文件
|
|
|
|
def read_stu_csv():
|
|
|
|
def read_stu_csv():
|
|
|
|
stus = pd.read_csv("stu.csv",index_col= False)
|
|
|
|
stus = pd.read_csv("stu.csv", index_col= False)
|
|
|
|
|
|
|
|
return stus
|
|
|
|
return stus
|
|
|
|
|
|
|
|
# 查询全部学生信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 查询全部学生信息
|
|
|
|
|
|
|
|
|
|
|
|
def read_all_stus():
|
|
|
|
def read_all_stus():
|
|
|
|
stus = read_stu_csv()
|
|
|
|
stus = read_stu_csv()
|
|
|
@ -77,8 +75,9 @@ def read_someone_by_phone():
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
read_someone_by_phone()
|
|
|
|
read_someone_by_phone()
|
|
|
|
# 通过姓名/电话查询某个学生信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 通过姓名/电话查询某个学生信息
|
|
|
|
def read_stu():
|
|
|
|
def read_stu():
|
|
|
|
stus = read_stu_csv()
|
|
|
|
stus = read_stu_csv()
|
|
|
|
stu_names = stus['姓名'].values.tolist()
|
|
|
|
stu_names = stus['姓名'].values.tolist()
|
|
|
@ -159,7 +158,7 @@ def update_by_name():
|
|
|
|
display(stus)
|
|
|
|
display(stus)
|
|
|
|
stu_names = stus['姓名'].values.tolist()
|
|
|
|
stu_names = stus['姓名'].values.tolist()
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
stu_name = input("请输入待添加学生姓名")
|
|
|
|
stu_name = input("请输入待修改学生姓名")
|
|
|
|
if stu_name not in stu_names:
|
|
|
|
if stu_name not in stu_names:
|
|
|
|
print_message("学生不存在,请重新输入!")
|
|
|
|
print_message("学生不存在,请重新输入!")
|
|
|
|
continue
|
|
|
|
continue
|
|
|
@ -206,6 +205,10 @@ def update_by_name():
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update_by_name()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 通过电话修改某个学生电话
|
|
|
|
# 通过电话修改某个学生电话
|
|
|
|
|
|
|
|
|
|
|
|
def update_by_phone():
|
|
|
|
def update_by_phone():
|
|
|
@ -213,7 +216,7 @@ def update_by_phone():
|
|
|
|
display(stus)
|
|
|
|
display(stus)
|
|
|
|
stu_phones = stus['电话'].values.tolist()
|
|
|
|
stu_phones = stus['电话'].values.tolist()
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
stu_phone = input("请输入待添加学生电话")
|
|
|
|
stu_phone = input("请输入待修改学生电话")
|
|
|
|
if int(stu_phone) not in stu_phones:
|
|
|
|
if int(stu_phone) not in stu_phones:
|
|
|
|
print_message("学生不存在,请重新输入!")
|
|
|
|
print_message("学生不存在,请重新输入!")
|
|
|
|
continue
|
|
|
|
continue
|
|
|
@ -261,7 +264,9 @@ def update_by_phone():
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update_by_phone()
|
|
|
|
update_by_phone()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 更改学生信息
|
|
|
|
# 更改学生信息
|
|
|
|
|
|
|
|
|
|
|
|
def update_stu():
|
|
|
|
def update_stu():
|
|
|
@ -310,4 +315,6 @@ def update_stu():
|
|
|
|
break
|
|
|
|
break
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
update_stu()
|
|
|
|
update_stu()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|