最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python實現(xiàn)班級檔案管理系統(tǒng)

 更新時間:2022年05月30日 13:52:47   作者:Xcodd  
這篇文章主要為大家詳細介紹了python實現(xiàn)班級檔案管理系統(tǒng),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了python實現(xiàn)班級檔案管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

功能要求

一、對一個有N個學(xué)生的班級,通過該系統(tǒng)實現(xiàn)對班級學(xué)生的基本信息進行錄入、顯示、修改、刪除、保存等操作的管理。

二、 功能要求

1.本系統(tǒng)序列或字典存放數(shù)據(jù),數(shù)據(jù)包括:學(xué)號、姓名、性別、年齡、備注。

2.本系統(tǒng)顯示這樣的菜單:

a.學(xué)生基本信息錄入
b.學(xué)生基本信息顯示
c.學(xué)生基本信息保存
d.學(xué)生基本信息刪除
e.學(xué)生基本信息修改
f.學(xué)生基本信息查詢
(1)按學(xué)號查詢
(2)按性別查詢
(3)按年齡查詢
g.退出系統(tǒng)

3.將學(xué)生基本信息保存到文件中。

4.進入系統(tǒng)之前要先輸入密碼

代碼如下

import openpyxl
from openpyxl import Workbook
import sys

s_information = [{'學(xué)號':'202031108041','姓名':'小明','性別':'男','年齡':'20','備注':'帥比'},
? ? ? ? ?{'學(xué)號':'202031108042','姓名':'小谷','性別':'女','年齡':'20','備注':'漂比'},
? ? ? ? ?{'學(xué)號':'202031108043','姓名':'小啊','性別':'男','年齡':'20','備注':'帥比'},
? ? ? ? ?{'學(xué)號':'202031108044','姓名':'小額','性別':'男','年齡':'20','備注':'帥比'},
? ? ? ? ?]

#登錄密碼

def print_menu():
? ? # 打印菜單
? ? print('-'*50)
? ? print('[1]:學(xué)生基本信息錄入')
? ? print('[2]:學(xué)生基本信息顯示')
? ? print('[3]:學(xué)生基本信息保存')
? ? print('[4]:學(xué)生基本信息刪除')
? ? print('[5]:學(xué)生基本信息修改')
? ? print('[6]:學(xué)生基本信息查詢')
? ? print('[7]:退出')
#基本信息錄入
def add_infomation():
? ? dic = {}
? ? while True:
? ? ? ? xuehao = input('請輸入你的學(xué)號:')
? ? ? ? for i in s_information:
? ? ? ? ? ? if i['學(xué)號'] == xuehao:
? ? ? ? ? ? ? ? print('學(xué)號已存在,請重新輸入')
? ? ? ? else:
? ? ? ? ? ? dic['學(xué)號'] = xuehao
? ? ? ? ? ? dic['姓名'] = input('請輸入姓名:')
? ? ? ? ? ? dic['性別'] = input('請輸入性別:')
? ? ? ? ? ? dic['年齡'] = input('請輸入年齡:')
? ? ? ? ? ? dic['備注'] = input('請輸入備注:')
? ? ? ? ? ? break
? ? s_information.append(dic)
#顯示所有信息
def show_information():
? ? for i in s_information:
? ? ? ? print(i)
#刪除學(xué)生信息,可以添加學(xué)生信息不在時的情況
def del_information():
? ? a = input('請輸入你要刪除的學(xué)生的姓名:')
? ? for i in s_information:
? ? ? ? if a == i['姓名']:
? ? ? ? ? ? s_information.remove(i)

#學(xué)生基本信息修改:
def change_information():
? ? a = input('請輸入你要修改人的信息,如姓名、電話')
? ? print('1、學(xué)號')
? ? print('2、姓名')
? ? print('3、性別')
? ? print('4、年齡')
? ? print('5、備注')
? ? b = input('請輸入你要修改的選項:')

? ? for i in s_information:
? ? ? ? if i['姓名'] == a :
? ? ? ? ? ? if b=="1":
? ? ? ? ? ? ? ? i['學(xué)號']=input('請輸入修改后的:')
? ? ? ? ? ? elif b=='2':
? ? ? ? ? ? ? ? i['姓名']=input('請輸入修改后的:')
? ? ? ? ? ? elif b=='3':
? ? ? ? ? ? ? ? i['性別'] = input('請輸入修改后的:')
? ? ? ? ? ? elif b=='4':
? ? ? ? ? ? ? ? i['年齡'] = input('請輸入修改后的:')
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? i['備注']= input('請輸入修改后的:')
? ? ? ? ? ? break
? ? ? ? elif i['學(xué)號'] == a :
? ? ? ? ? ? if b=="1":
? ? ? ? ? ? ? ? i['學(xué)號']=input('請輸入修改后的:')
? ? ? ? ? ? elif b=='2':
? ? ? ? ? ? ? ? i['姓名']=input('請輸入修改后的:')
? ? ? ? ? ? elif b=='3':
? ? ? ? ? ? ? ? i['性別'] = input('請輸入修改后的:')
? ? ? ? ? ? elif b=='4':
? ? ? ? ? ? ? ? i['年齡'] = input('請輸入修改后的:')
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? i['備注']= input('請輸入修改后的:')
? ? ? ? ? ? break
? ? ? ? else:
? ? ? ? ? ? print('請輸入學(xué)號、或姓名進行查詢')
#學(xué)生基本信息查詢
def select_information():
? ? a = input('請輸入你要查詢?nèi)说男彰驅(qū)W號')
? ? for i in s_information:
? ? ? ? if i['姓名'] ?== a:
? ? ? ? ? ? print(i)
? ? ? ? ? ? break
? ? ? ? elif i['學(xué)號'] == a :
? ? ? ? ? ? print(i)
? ? ? ? ? ? break
? ? ? ? else:
? ? ? ? ? ? print(''請輸入學(xué)號或者姓名進行查詢')
#學(xué)生信息保存
def write_tofile():
? ? a = input('請輸入你要保存文件的名稱:')
? ? wb=Workbook()
? ? sheet1 = wb.create_sheet('學(xué)生信息表',0)
? ? sheet1.cell(row=1,column=1).value='學(xué)號'
? ? sheet1.cell(row=1,column=2).value='姓名'
? ? sheet1.cell(row=1,column=3).value='性別'
? ? sheet1.cell(row=1,column=4).value='年齡'
? ? sheet1.cell(row=1,column=5).value='備注'
? ? for i in range(len(s_information)):
? ? ? ?
? ? ? ??
? ? ? ??
? ? ? ? sheet1.cell(row=i+2,column=1).value=s_information[i]['學(xué)號']
? ? ? ? sheet1.cell(row=i+2,column=2).value=s_information[i]['姓名']
? ? ? ? sheet1.cell(row=i+2,column=3).value=s_information[i]['性別']
? ? ? ? sheet1.cell(row=i+2,column=4).value=s_information[i]['年齡']
? ? ? ? sheet1.cell(row=i+2,column=5).value=s_information[i]['備注']
? ? ? ??
? ? wb.save('{}.xlsx'.format(a))

#離開程序 ? ?
def quit_information():
? ? sys.exit(0) ? ? ??

#設(shè)置主函數(shù)
def main2():
? ? ? while True:#設(shè)置登錄密碼
? ? ? ? ? ? print('------登陸-------')
? ? ? ? ? ? print('賬號是學(xué)號,密碼是學(xué)號后五位')
? ? ? ? ? ? key_word = input("賬號:")
? ? ? ? ? ? password = input("密碼:")

? ? ? ? ? ? while True and password == ?key_word[-5:] and len(key_word) > 5:
? ? ? ? ? ? ? ? print('------班級管理系統(tǒng)------')
? ? ? ? ? ?
? ? ? ? ? ? ? ? print_menu() ? ?# 打印菜單
? ? ? ? ? ? ? ? num = input('請輸入您的選項:')
? ? ? ? ? ? ? ? if num == '1':
? ? ? ? ? ? ? ? ? ? add_infomation() ?# 添加圖書
? ? ? ? ? ? ? ? elif num == '2':
? ? ? ? ? ? ? ? ? ? show_information() ?# 刪除圖書
? ? ? ? ? ? ? ? elif num == '3':
? ? ? ? ? ? ? ? ? ? write_tofile() # 查詢所有圖書
? ? ? ? ? ? ? ? elif num == '4':
? ? ? ? ? ? ? ? ? ? del_information()
? ? ? ? ? ? ? ? elif num == '5':
? ? ? ? ? ? ? ? ? ? change_information()
? ? ? ? ? ? ? ? elif num == '6':
? ? ? ? ? ? ? ? ? ? select_information()
? ? ? ? ? ? ? ? elif num == '7':
? ? ? ? ? ? ? ? ? ? quit_information()

? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? print('您選擇的有誤,請重新選擇')
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? print('你輸入的密碼有誤,請重新輸入')

if __name__ == '__main__':
? ? main2()

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

乾安县| 福贡县| 巨鹿县| 铜陵市| 海晏县| 平湖市| 漾濞| 常宁市| 天等县| 富宁县| 皋兰县| 高密市| 玉环县| 松阳县| 新乡市| 江都市| 安阳县| 忻州市| 乌拉特前旗| 防城港市| 潮州市| 肥西县| 大埔区| 黄陵县| 贡觉县| 来宾市| 明溪县| 宜川县| 衡南县| 裕民县| 湖北省| 泗阳县| 平塘县| 富阳市| 西充县| 天祝| 平原县| 永春县| 新丰县| 壶关县| 高要市|