# 需要完成的基本功能:
# 1. 添加名片
# 2. 删除名片
# 3. 修改名片
# 4. 查询名片
# 5. 退出系统
# 程序运行后,除非选择退出系统,否则重复执行功能
id_list = []
import shelve
flag = 0 #判断是否存在某id卡片
s = shelve.open("student", "c",writeback=True)
# f = open("stunamelist.txt","ra+")
def find(id):
'''
查找是否存在该卡片
:param id: 学生id
:return:
'''
global flag
flag = 0
global s
try:
s1 = s[id]
except:
flag = 0
print("flag is 0")
else:
flag = 1
print("flag is 1")
def add():
'''
实现增加学生卡片功能
:return: void
'''
# global arr
global s
id = input("please enter the id")
find(id)
if flag==0:
name = input("please enter the name")
age = input("please enter the age")
gender = input("please enter the gender"
Python---学生卡片
最新推荐文章于 2023-06-21 23:28:00 发布
本文介绍了如何使用Python编程实现一个简单的学生信息管理系统,包括添加、删除、查询学生卡片功能,探讨了基本的数据结构和文件操作。
摘要由CSDN通过智能技术生成