資源簡介
代碼片段和文件信息
import?reos
filename?=?“student.txt“
def?main():
????“““主函數:主要用于實現系統的主頁面“““
????ctrl?=?True???????#?標記是否退出系統
????while(ctrl):
????????menu()?????????#?顯示菜單
????????option?=?input(“請選擇:“)???#?選擇菜單項
????????option_str?=?re.sub(“\D“?““?option)???#?提取數字???re.sub()函數可以匹配任意的數字,并將數字替換
????????if?option_str?in?[‘0‘‘1‘‘2‘‘3‘‘4‘‘5‘‘6‘‘7‘]:
????????????option_int?=?int(option_str)
????????????if?option_int?==?0:????#?退出系統
????????????????print(“您已退出學生信息管理系統!“)
????????????????ctrl?=?False
????????????elif?option_int?==?1:
????????????????#?錄入學生成績信息
????????????????insert()
????????????elif?option_int?==?2:
????????????????#?查找學生成績信息
????????????????search()
????????????elif?option_int?==?3:
????????????????#?刪除學生成績信息
????????????????delete()
????????????elif
評論
共有 條評論