Python實(shí)現(xiàn)一個(gè)簡單的畢業(yè)生信息管理系統(tǒng)的示例代碼
寫在前面:
從昨晚的夢里回憶起數(shù)據(jù)管理的作業(yè):
實(shí)現(xiàn)一個(gè)自己的選題----
畢業(yè)生信息管理系統(tǒng),實(shí)現(xiàn)學(xué)生個(gè)人信息基本的增刪改查,
我想了想前段時(shí)間剛學(xué)習(xí)的列表,這個(gè)簡單啊 ,設(shè)計(jì)一個(gè)學(xué)生信息列表,然后列表里面再存每個(gè)學(xué)生詳細(xì)信息的列表,然后來實(shí)現(xiàn)一個(gè)基本的增刪查改,這個(gè)不難啊!直接開始擼代碼!
上代碼!
def Menu():##菜單主界面 print('*'*22) print("* 查看畢業(yè)生列表輸入: 1 *") print("* 添加畢業(yè)生信息輸入: 2 *") print("* 修改畢業(yè)生信息輸入: 3 *") print("* 刪除畢業(yè)生信息輸入: 4 *") print("* 退出系統(tǒng)請輸入 0 *") print('*'*22) def CheckIdisRight(StudentList,id):##檢查學(xué)號是否在列表中 for i in range(0, len(StudentList)): if((id in StudentList[i])==True): return True return False def PrintStudentList(StudentList):#打印學(xué)生信息列表 for i in range(0, len(StudentList)): print(StudentList[i]) def AddStudent(StudentList):##添加學(xué)生信息 number = int((input("請輸入學(xué)號: "))) if(number<1000000000 and CheckIdisRight(StudentList,number)==False):##學(xué)號判斷 print("學(xué)號輸入錯(cuò)誤&學(xué)號已存在!請重新輸入:") number = (input("請輸入學(xué)號: ")) name = input("請輸入你的名字:") tell = input("請輸入你的電話:") if(len(tell)!=11): print("請輸入正確的電話號碼(11)位: ") tell = input() college = input("請輸入你的學(xué)院名稱:") grade = input("請輸入你的年級:") isjob = int(input("是否就業(yè)?:是填 1 否則填0: ")) if(isjob == 1): company = input("請輸入你公司的名稱:") else: company = 0 arry = [number, name, tell, college, grade, isjob, company] StudentList.append(arry)##將新建的學(xué)生信息進(jìn)行插入 PrintStudentList(StudentList)##打印學(xué)生信息列表 def StudentPersonalMsg():##修改信息界面選擇 print('*' * 22) print("* 修改姓名請輸入: 1 *") print("* 修改電話號碼請輸入: 2 *") print("* 修改是否就業(yè)請輸入: 3 *") print("* 修改就業(yè)公司請輸入: 4 *") print("* 退出修改請輸入: 0 *") print('*' * 22) def ChangeStudent(StudentList):##修改學(xué)生信息模塊 ##默認(rèn)學(xué)號 年級 等信息不可修改 def changename(StudentList, arry, i):#修改姓名 print(arry) name = input("請輸入修改后的名字:") StudentList[i][1] = name print("修改后為:") PrintStudentList(StudentList) def changetell(StudentList, arry, i):#修改電話號碼 print(arry) tell = input("請輸入修改后的電話號碼:") StudentList[i][2] = tell print("修改后為:") PrintStudentList(StudentList) def changeisgob(StudentList, arry, i):#修改是否就業(yè)情況 print(arry) isgob = int(input("請輸入修改后的 是否工作:")) StudentList[i][5] = isgob print("修改后為:") PrintStudentList(StudentList) def changcompany(StudentList, arry, i):#修改就業(yè)公司信息 print(arry) company = input("請輸入修改后的公司為:") StudentList[i][6] = company print("修改后為:") PrintStudentList(StudentList) print("請輸入要修改的學(xué)生的學(xué)號:") id = int(input()) i=1 if((CheckIdisRight(StudentList,id))==False):##判斷學(xué)號是否存在 print("學(xué)號不存在!") if(CheckIdisRight(StudentList,id)==True): while (i < len(StudentList)):#通過循環(huán)找到該學(xué)生的信息列表 if (StudentList[i][0] == id): StudentPersonalMsg()##顯示出修改的菜單選項(xiàng) while (1): a = int(input("請輸入: ")) while (a): if (a == 1): ##姓名修改 changename(StudentList, StudentList[i], i) break if (a == 2): ##電話號碼修改 changetell(StudentList, StudentList[i], i) break if (a == 3): ##是否就業(yè)狀態(tài)修改 changeisgob(StudentList, StudentList[i], i) break if (a == 4 and StudentList[i][5] == 1): ##就業(yè)公司修改 changcompany(StudentList, StudentList[i], i) break if (a == 4 and StudentList[i][5] == 0): print("學(xué)生尚未就業(yè),請先修改是否就業(yè)信息!") break if (a == 0): ##按0 退出修改信息功能 break ##返回到主界面的菜單選項(xiàng) break i = i + 1 def DeleteStudent(StudentList):##刪除學(xué)生信息 print("請輸入要?jiǎng)h除的學(xué)生的學(xué)號:輸入0退出!") id = int(input()) i = 1 if((CheckIdisRight(StudentList,id))==False): print("學(xué)號不存在!") if(CheckIdisRight(StudentList,id)==True): ##同樣先判斷學(xué)號學(xué)號是否存在 while (i < len(StudentList)): if (StudentList[i][0] == id): del StudentList[i] print("刪除成功!") break if (id == 0): break i = i + 1 PrintStudentList(StudentList)#打印學(xué)生信息列表 def main(): Menu() StudentInfo = ['學(xué)號', '姓名', '電話', '學(xué)院', '年級', '是否就業(yè)', "就業(yè)公司"] ##先默認(rèn)插入一個(gè)用于顯示的列表的列表 StudentList = [StudentInfo] while(1): a = int(input("請輸入: ")) while(a): if(a==1): PrintStudentList(StudentList) Menu() break if(a==2): AddStudent(StudentList) Menu() break if(a==3): ChangeStudent(StudentList) Menu() break if(a==4): DeleteStudent(StudentList) Menu() break if (a == 0):##按0退出進(jìn)程 exit() main()
再看測試效果圖:
主界面
1.查看畢業(yè)學(xué)生信息列表
2.增加畢業(yè)學(xué)生信息
3.修改畢業(yè)學(xué)生信息
4.刪除畢業(yè)生信息
大致實(shí)現(xiàn)了一下功能,但是萬萬沒想到?。?!
一時(shí)語塞的我 :我 *******(這就是不看文檔的后果吧?。?/p>
算了算了,再重寫一個(gè)!
到此這篇關(guān)于Python實(shí)現(xiàn)一個(gè)簡單的畢業(yè)生信息管理系統(tǒng)的示例代碼的文章就介紹到這了,更多相關(guān)Python 畢業(yè)生信息管理系統(tǒng)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- python實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)(精簡版)
- Python使用文件操作實(shí)現(xiàn)一個(gè)XX信息管理系統(tǒng)的示例
- python實(shí)現(xiàn)簡單學(xué)生信息管理系統(tǒng)
- python學(xué)生信息管理系統(tǒng)實(shí)現(xiàn)代碼
- 基于python實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)
- python實(shí)現(xiàn)簡易學(xué)生信息管理系統(tǒng)
- python學(xué)生信息管理系統(tǒng)(完整版)
- python學(xué)生信息管理系統(tǒng)(初級版)
- 學(xué)生信息管理系統(tǒng)python版
- python實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)
- python學(xué)生信息管理系統(tǒng)
- python 實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)的示例
相關(guān)文章
python中zip()函數(shù)遍歷多個(gè)列表方法
在本篇文章里小編給大家整理的是一篇關(guān)于python中zip()函數(shù)遍歷多個(gè)列表方法,對此有興趣的朋友們可以學(xué)習(xí)下。2021-02-02Python字典中的鍵映射多個(gè)值的方法(列表或者集合)
今天小編就為大家分享一篇Python字典中的鍵映射多個(gè)值的方法(列表或者集合),具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-10-10使用python實(shí)現(xiàn)3D聚類圖示例代碼
這篇文章主要介紹了使用python實(shí)現(xiàn)3D聚類圖效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧2024-08-08Python numpy.power()函數(shù)使用說明
這篇文章主要介紹了Python numpy.power()函數(shù)使用說明,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2021-03-03