Python實(shí)現(xiàn)功能全面的學(xué)生管理系統(tǒng)
本文實(shí)例為大家分享了Python實(shí)現(xiàn)學(xué)生管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
功能描述
1.分為兩個(gè)界面:(1)登錄和注冊(cè)界面 (2)學(xué)生管理系統(tǒng)界面
2.登錄功能和之前發(fā)布的圖書(shū)管理系統(tǒng)相同,登錄成功后可進(jìn)入學(xué)生管理系統(tǒng)界面,這里不再敘述
3.系統(tǒng)功能(1)添加學(xué)生信息(2)刪除學(xué)生信息(3)修改學(xué)生信息(4)查詢(xún)學(xué)生信息(5)顯示所有學(xué)生信息(6)退出
4.有很多地方增加了優(yōu)化,也進(jìn)行了完善,如模塊導(dǎo)入、登錄注冊(cè)以及回車(chē)不修改等功能。整個(gè)程序代碼大概200行。
注意:代碼分為兩個(gè)模塊,需要在student_main模塊中啟動(dòng)。student_main模塊中只負(fù)責(zé)輸入操作,而student_tools模塊中負(fù)責(zé)具體的學(xué)生信息系統(tǒng)操作實(shí)現(xiàn)功能。所以大家在拷貝代碼的時(shí)候記得創(chuàng)建兩個(gè).py文件。
完整代碼如下
student_main模塊內(nèi)容代碼:
import student_tools user=['wangtaotao'] pwd=['123456'] #登錄 def denglu(): ? ? users = input("請(qǐng)輸入您的用戶(hù)名:") ? ? pwds = input("請(qǐng)輸入您的密碼:") ? ? if users in user and pwds in pwd: ? ? ? ? student() ? ? else: ? ? ? ? print("賬號(hào)或密碼不正確,請(qǐng)重新輸入") #注冊(cè) def zhuce(): ? ? users=input("請(qǐng)輸入您要注冊(cè)的用戶(hù)名:") ? ? pwds=input("請(qǐng)輸入您要注冊(cè)的密碼:") ? ? user.append(users) ? ? pwd.append(pwds) ? ? print() ? ? print("注冊(cè)成功!") ? ? print() #登錄界面 def dljiemian(): ? ? while True: ? ? ? ? print("---------------------------") ? ? ? ? print(" ? ?學(xué)生管理系統(tǒng)登陸界面 V1.0 ?") ? ? ? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ") ? ? ? ? print(" ? ? ? ?1:登 ? 錄 ? ? ? ? ? ") ? ? ? ? print(" ? ? ? ?2:注 ? 冊(cè) ? ? ? ? ? ") ? ? ? ? print(" ? ? ? ?3:退 ? 出 ? ? ? ? ? ") ? ? ? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ") ? ? ? ? print("---------------------------") ? ? ? ? xx=input("請(qǐng)輸入您的選擇:") ? ? ? ? #1.登錄 ? ? ? ? if xx=='1': ? ? ? ? ? ? denglu() ? ? ? ? elif xx=='2': ? ? ? ? #2.注冊(cè) ? ? ? ? ? ? zhuce() ? ? ? ? elif xx=='3': ? ? ? ? #3.退出 ? ? ? ? ? ? print() ? ? ? ? ? ? print("成功退出!") ? ? ? ? ? ? print() ? ? ? ? ? ? break ? ? ? ? else: ? ? ? ? ? ? print("輸入錯(cuò)誤,請(qǐng)重新輸入") #學(xué)生管理系統(tǒng) def student(): ? ? while True: ? ? ? ? #調(diào)用student_tools模塊中的界面函數(shù) ? ? ? ? student_tools.jiemian() ? ? ? ? x=input("請(qǐng)輸入您的選擇:") ? ? ? ? #添加學(xué)生 ? ? ? ? if x=='1': ? ? ? ? ? ? student_tools.add() ? ? ? ? #刪除學(xué)生 ? ? ? ? elif x=='2': ? ? ? ? ? ? student_tools.dele() ? ? ? ? #修改學(xué)生 ? ? ? ? elif x=='3': ? ? ? ? ? ? student_tools.xiugai() ? ? ? ? #查詢(xún)學(xué)生 ? ? ? ? elif x=='4': ? ? ? ? ? ? student_tools.find() ? ? ? ? #顯示所有學(xué)生 ? ? ? ? elif x=='5': ? ? ? ? ? ? student_tools.showall() ? ? ? ? #退出學(xué)生管理系統(tǒng),返回上一層登錄界面系統(tǒng) ? ? ? ? elif x=='6': ? ? ? ? ? ? print() ? ? ? ? ? ? print("成功退出學(xué)生管理系統(tǒng)!") ? ? ? ? ? ? break ? ? ? ? else: ? ? ? ? ? ? print() ? ? ? ? ? ? print("輸入錯(cuò)誤,請(qǐng)重新輸入") ? ? ? ? ? ? print() #調(diào)用最先執(zhí)行的登錄界面函數(shù) dljiemian()
student_tools模塊內(nèi)容代碼:
student_list=[] student_dict={} #學(xué)生管理系統(tǒng)界面 def jiemian(): ? ? print("---------------------------") ? ? print(" ? ? ?學(xué)生管理系統(tǒng) V1.0") ? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ") ? ? print(" ? ? ?1:添加學(xué)生" ? ? ? ? ? ?) ? ? print(" ? ? ?2:刪除學(xué)生" ? ? ? ? ? ?) ? ? print(" ? ? ?3:修改學(xué)生" ? ? ? ? ? ?) ? ? print(" ? ? ?4:查詢(xún)學(xué)生" ? ? ? ? ? ?) ? ? print(" ? ? ?5:顯示所有學(xué)生" ? ? ? ? ) ? ? print(" ? ? ?6:退出系統(tǒng)" ? ? ? ? ? ?) ? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ") ? ? print("---------------------------") #添加學(xué)生 def add(): ? ? name=input("請(qǐng)輸入錄入學(xué)生姓名:") ? ? cls=input("請(qǐng)輸入學(xué)生班級(jí):") ? ? age=input("請(qǐng)輸入錄入學(xué)生年齡:") ? ? phone=input("請(qǐng)輸入錄入學(xué)生手機(jī)號(hào):") ? ? addr=input("請(qǐng)輸入錄入學(xué)生家庭住址:") ? ? student_dict={"name":name,"class":cls,"age":age,"phone":phone,"address":addr} ? ? student_list.append(student_dict) ? ? print() ? ? print("-----添加學(xué)生信息界面-----") ? ? print() ? ? print("姓名\t\t","班級(jí)\t\t","年齡\t\t","電話(huà)號(hào)\t\t","家庭住址\t\t") ? ? for student_dict_1 in student_list: ? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" %(student_dict_1["name"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["class"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["age"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["phone"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["address"])) ? ? print() ? ? print("錄入成功!") ? ? print() #刪除學(xué)生 def dele(): ? ? name_del=input("請(qǐng)輸入想要?jiǎng)h除的學(xué)生姓名:") ? ? for student_dict_1 in student_list: ? ? ? ? if name_del in student_dict_1["name"]: ? ? ? ? ? ? student_list.remove(student_dict_1) ? ? ? ? ? ? print() ? ? ? ? ? ? print("刪除%s信息成功!" % name_del) ? ? ? ? ? ? print() ? ? ? ? ? ? break ? ? else: ? ? ? ? print() ? ? ? ? print("您輸入的學(xué)生姓名錯(cuò)誤,請(qǐng)重新輸入") ? ? ? ? print() #修改學(xué)生 def xiugai(): ? ? name_xiugai=input("請(qǐng)輸入想要修改的學(xué)生姓名:") ? ? for student_dict_1 in student_list: ? ? ? ? if name_xiugai == student_dict_1["name"]: ? ? ? ? ? ? print() ? ? ? ? ? ? print("-----修改界面-----") ? ? ? ? ? ? print() ? ? ? ? ? ? print("姓名\t\t", "班級(jí)\t\t", "年齡\t\t", "電話(huà)號(hào)\t\t", "家庭住址\t\t") ? ? ? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" %(student_dict_1["name"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["class"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["age"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["phone"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["address"])) ? ? ? ? ? ? #回車(chē)不修改 ? ? ? ? ? ? student_dict_1["name"]=new_input(student_dict_1["name"],"請(qǐng)輸入修改后的學(xué)生姓名[回車(chē)不修改]:") ? ? ? ? ? ? student_dict_1["class"]=new_input(student_dict_1["class"],"請(qǐng)輸入修改后的學(xué)生班級(jí)[回車(chē)不修改]:") ? ? ? ? ? ? student_dict_1["age"]=new_input(student_dict_1["age"],"請(qǐng)輸入修改后的學(xué)生年齡[回車(chē)不修改]:") ? ? ? ? ? ? student_dict_1["phone"]=new_input(student_dict_1["phone"],"請(qǐng)輸入修改后的學(xué)生手機(jī)號(hào)[回車(chē)不修改]:") ? ? ? ? ? ? student_dict_1["address"]=new_input(student_dict_1["address"],"請(qǐng)輸入修改后的學(xué)生家庭地址[回車(chē)不修改]:") ? ? ? ? ? ? print() ? ? ? ? ? ? print("修改成功!") ? ? ? ? ? ? print() ? ? ? ? ? ? break ? ? else: ? ? ? ? print() ? ? ? ? print("您輸入的學(xué)生姓名錯(cuò)誤,請(qǐng)重新輸入") ? ? ? ? print() #查找學(xué)生 def find(): ? ? find_name=input("請(qǐng)輸入需要查找的學(xué)生姓名:") ? ? for student_dict_1 in student_list: ? ? ? ? if find_name == student_dict_1["name"]: ? ? ? ? ? ? print() ? ? ? ? ? ? print("-----查詢(xún)結(jié)果界面-----") ? ? ? ? ? ? print() ? ? ? ? ? ? print("姓名\t\t", "班級(jí)\t\t", "年齡\t\t", "電話(huà)號(hào)\t\t", "家庭住址\t\t") ? ? ? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" % (student_dict_1["name"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["class"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["age"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["phone"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["address"])) ? ? ? ? else: ? ? ? ? ? ? print() ? ? ? ? ? ? print("-----查詢(xún)結(jié)果界面-----") ? ? ? ? ? ? print() ? ? ? ? ? ? print("無(wú)此學(xué)生信息") #顯示所有學(xué)生信息 def showall(): ? ? print() ? ? print("-----顯示所有學(xué)生信息-----") ? ? print() ? ? print("姓名\t\t", "班級(jí)\t\t", "年齡\t\t", "電話(huà)號(hào)\t\t", "家庭住址\t\t") ? ? for student_dict_1 in student_list: ? ? ? ? print(student_dict_1) ? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" % (student_dict_1["name"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["class"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["age"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["phone"], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["address"])) #設(shè)置用戶(hù)不輸入內(nèi)容返回原值,輸入內(nèi)容返回新內(nèi)容 def new_input(yuanzhi,message): ? ? input_str=input(message) ? ? if len(input_str)>0: ? ? ? ? return input_str ? ? else: ? ? ? ? return yuanzhi
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Python實(shí)現(xiàn)一個(gè)完整學(xué)生管理系統(tǒng)
- 基于Python實(shí)現(xiàn)一個(gè)簡(jiǎn)單的學(xué)生管理系統(tǒng)
- 基于Python實(shí)現(xiàn)面向?qū)ο蟀鎸W(xué)生管理系統(tǒng)
- Python實(shí)現(xiàn)學(xué)生管理系統(tǒng)并生成exe可執(zhí)行文件詳解流程
- 一篇文章教你用Python實(shí)現(xiàn)一個(gè)學(xué)生管理系統(tǒng)
- Python實(shí)現(xiàn)學(xué)生管理系統(tǒng)(面向?qū)ο蟀?
- python實(shí)現(xiàn)學(xué)生管理系統(tǒng)源碼
- Python使用pyinstaller實(shí)現(xiàn)學(xué)生管理系統(tǒng)流程
相關(guān)文章
Python讀取多列數(shù)據(jù)以及用matplotlib制作圖表方法實(shí)例
這篇文章主要給大家介紹了關(guān)于Python讀取多列數(shù)據(jù)以及用matplotlib制作圖表的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-09-09Python圖像處理之Hough變換檢測(cè)直線(xiàn)
霍夫變換是一種特征檢測(cè)(feature?extraction),被廣泛應(yīng)用在圖像分析,本文將利用Hough變換實(shí)現(xiàn)直線(xiàn)檢測(cè),感興趣的小伙伴可以了解一下2023-07-07基于進(jìn)程內(nèi)通訊的python聊天室實(shí)現(xiàn)方法
這篇文章主要介紹了基于進(jìn)程內(nèi)通訊的python聊天室實(shí)現(xiàn)方法,實(shí)例分析了Python聊天室的相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2015-06-06python模擬嗶哩嗶哩滑塊登入驗(yàn)證的實(shí)現(xiàn)
這篇文章主要介紹了python模擬嗶哩嗶哩滑塊登入驗(yàn)證的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-04-04python通過(guò)urllib2爬網(wǎng)頁(yè)上種子下載示例
這篇文章主要介紹了通過(guò)urllib2、re模塊抓種子下載的示例,需要的朋友可以參考下2014-02-02Python3實(shí)現(xiàn)從排序數(shù)組中刪除重復(fù)項(xiàng)算法分析
這篇文章主要介紹了Python3實(shí)現(xiàn)從排序數(shù)組中刪除重復(fù)項(xiàng)算法,結(jié)合3個(gè)完整實(shí)例形式分析了Python3針對(duì)排序數(shù)組的遍歷、去重、長(zhǎng)度計(jì)算等相關(guān)操作技巧,需要的朋友可以參考下2019-04-04使用tensorflow實(shí)現(xiàn)VGG網(wǎng)絡(luò),訓(xùn)練mnist數(shù)據(jù)集方式
這篇文章主要介紹了使用tensorflow實(shí)現(xiàn)VGG網(wǎng)絡(luò),訓(xùn)練mnist數(shù)據(jù)集方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-05-05Python如何在循環(huán)內(nèi)使用list.remove()
這篇文章主要介紹了Python如何在循環(huán)內(nèi)使用list.remove(),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-06-06