from time import sleep
from random import randint
data = [{"ID":1000000001, "name":"None", "sex":"男", "address":"青海"},
{"ID":1929489285, "name":"False", "sex":"女", "address":"computer"}]
while True:
print(" ****************************************")
print(" 欢迎使用学生管理系统v1.0(后续有2.0)")
print(" 1.显示所有学生")
print(" 2.新建学生档案")
print(" 3.查询学生信息")
print(" 4.修改学生档案")
print(" 5.删除学生档案")
print(" 0.退出")
print(" ****************************************")
print()
def print_all():
for student in data:
print(student)
pass
pass
def someThing_put_in():
ID = randint(1000000000, 9999999999)
try:
if ID in data:
ID = randint(1000000000, 9999999999)
except:
print("调试错误!")
someName = input("输入姓名:")
someSex = input("输入性别:")
someAddress = input("输入地址:")
student = {"ID":ID, "name":someName, "sex":someSex, "address":someAddress}
data.append(student)
someThing = input("Enter the num:")
if someThing == "0":
break
elif someThing == "1":
print_all()
continue
elif someThing == "2":
print("好的")
print()
sleep(1)
someThing_put_in()
|