You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import re
import os
info = [ ]
def a ( ) :
print ( " 请选择如下功能: " )
print ( " 1: 添加学员: " )
print ( " 2: 删除学员 " )
print ( " 3: 修改学员信息 " )
print ( " 4: 查询学员信息 " )
print ( " 5: 显示所有学员信息 " )
print ( " 6: 保存学员信息 " )
print ( " 7: 退出系统 " )
def b ( ) :
new_name = input ( " 请输入您的姓名: " )
new_sex = input ( " 请输入您的性别: " )
new_num = input ( " 请输入您的电话: " )
global info
for i in info :
if new_name == i [ ' name ' ] :
print ( ' 用户已存在 ' )
return
info_dict = { ' name ' : new_name , ' sex ' : new_sex , ' num ' : new_num }
info . append ( info_dict )
print ( " {} , {} , {} " . format ( new_name , new_sex , new_num ) )
def c ( ) :
del_name = input ( ' 请输入要删除的学员的姓名: ' )
global info
for i in info :
if del_name == i [ ' name ' ] :
info . remove ( i )
break
else :
print ( ' 该学员不存在 ' )
print ( info )
def d ( ) :
modify_name = input ( ' 请输入要修改的学员的姓名: ' )
global info
for i in info :
if modify_name == i [ ' name ' ] :
i [ ' name ' ] = input ( ' 请输入新的姓名 ' )
i [ ' sex ' ] = input ( ' 请输入性别 ' )
i [ ' num ' ] = input ( ' 请输入新的手机号: ' )
break
else :
print ( ' 该学员不存在 ' )
print ( info )
while True :
a ( )
user_num = int ( input ( ' 请输入您需要的功能序号: ' ) )
if user_num == 1 :
b ( )
elif user_num == 3 :
c ( )
elif user_num == 4 :
d ( )
else :
print ( " 输入功能序号有误 " )
continue