Python---学生卡片

本文介绍了如何使用Python编程实现一个简单的学生信息管理系统,包括添加、删除、查询学生卡片功能,探讨了基本的数据结构和文件操作。
摘要由CSDN通过智能技术生成
# 需要完成的基本功能:
# 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"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值