国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

python學(xué)習(xí)-學(xué)生信息管理系統(tǒng)并打包exe

這篇具有很好參考價(jià)值的文章主要介紹了python學(xué)習(xí)-學(xué)生信息管理系統(tǒng)并打包exe。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

在B站自學(xué)Python
站主:Python_子木
授課:楊淑娟
平臺(tái): 馬士兵教育
python: 3.9.9文章來源地址http://www.zghlxwxcb.cn/news/detail-421531.html

python打包exe文件

#安裝PyInstaller
pip install PyInstaller
#-F打包exe文件,stusystem\stusystem.py到py的路徑,可以是絕對(duì)路徑,可以是相對(duì)路徑
pyinstaller -F stusystem\stusystem.py

學(xué)生信息管理系統(tǒng)具體代碼如下

import os.path
filename='student.txt'
def main():
    while True:
        menu()
        choice = int(input('請(qǐng)選擇'))
        if choice in range(8):
            if choice==0:
                answer=input('您確定要退出系統(tǒng)嗎?y/n')
                if answer.lower()=='y':
                    print('謝謝您的使用!')
                    break #退出系統(tǒng)
                else:
                    continue
            if choice==1:
                insert()
            if choice==2:
                search()
            if choice==3:
                delete()
            if choice==4:
                modify()
            if choice==5:
                sort()
            if choice==6:
                total()
            if choice==7:
                show()
        else:
            print('無此功能,請(qǐng)按菜單重新選擇')
def menu():
    print('=========================學(xué)生信息管理系統(tǒng)============================')
    print('-----------------------------功能菜單------------------------------')
    print('\t\t\t\t\t\t1.錄入學(xué)生信息')
    print('\t\t\t\t\t\t2.查找學(xué)生信息')
    print('\t\t\t\t\t\t3.刪除學(xué)生信息')
    print('\t\t\t\t\t\t4.修改學(xué)生信息')
    print('\t\t\t\t\t\t5.排序')
    print('\t\t\t\t\t\t6.統(tǒng)計(jì)學(xué)生總?cè)藬?shù)')
    print('\t\t\t\t\t\t7.顯示所有學(xué)生信息')
    print('\t\t\t\t\t\t0.退出')
    print('------------------------------------------------------------------')

def insert():
    student_list=[]
    while True:
        id=input('請(qǐng)輸入ID(如1001):')
        if not id:
            break
        name=input('請(qǐng)輸入姓名:')
        if not name:
            break
        try:
            english=int(input('請(qǐng)輸入英語成績(jī):'))
            python=int(input('請(qǐng)輸入Python成績(jī):'))
            java=int(input('請(qǐng)輸入Java成績(jī):'))
        except:
            print('輸入無效,不是整數(shù)類型,請(qǐng)重新輸入')
            continue
        #將錄入的學(xué)生保存到字典中
        student={'id':id,'name':name,'english':english,'python':python,'java':java}
        #將學(xué)生信息添加到列表中
        student_list.append(student)
        answer=input('是否繼續(xù)添加?y/n')
        if answer.lower()=='y':
            continue
        else:
            break

    #調(diào)用save()函數(shù)
    save(student_list)
    print('學(xué)生信息錄入完畢!!!')

def save(lst):
    try:
        stu_txt=open(filename,'a',encoding='utf-8')
    except:
        stu_txt=open(filename,'w',encoding='utf-8')
    for item in lst:
        stu_txt.write(str(item)+'\n')
    stu_txt.close()

def search():
    student_query=[]
    while True:
        id=''
        name=''
        if os.path.exists(filename):
            mode=input('按ID查找請(qǐng)輸入1,按姓名查找請(qǐng)輸入2:')
            if mode=='1':
                id=input('請(qǐng)輸入學(xué)生ID:')
            elif mode=='2':
                name=input('請(qǐng)輸入學(xué)生姓名:')
            else:
                print('您輸入有誤,請(qǐng)重新輸入')
                continue
            with open(filename,'r',encoding='utf-8') as rfile:
                student=rfile.readlines()
                for item in student:
                    d=dict(eval(item))
                    if id!='':
                        if d['id']==id:
                            student_query.append(d)
                    elif name!='':
                        if d['name']==name:
                            student_query.append(d)
            #顯示查詢結(jié)果
            show_student(student_query)
            #清空列表
            student_query.clear()
            answer=input('是否要繼續(xù)查詢?y/n\n')
            if answer.lower()=='y':
                continue
            else:
                break
        else:
            print('暫未保存學(xué)生信息')
            return
def show_student(lst):
    if len(lst)==0:
        print('沒有查詢到學(xué)生信息,無數(shù)據(jù)顯示!!!')
        return
    #定義標(biāo)題顯示格式
    format_title='{:^6}\t{:^12}\t{:^8}\t{:^10}\t{:^10}\t{:^8}\t'
    print(format_title.format('ID','姓名','英語成績(jī)','Python成績(jī)','Java成績(jī)','總成績(jī)'))
    #定義內(nèi)容顯示格式
    format_data='{:^6}\t{:^12}\t{:^8}\t{:^8}\t{:^8}\t{:^8}\t'
    for item in lst:
        print(format_data.format(item.get('id'),
                                 item.get('name'),
                                 item.get('english'),
                                 item.get('python'),
                                 item.get('java'),
                                 int(item.get('english'))+int(item.get('python'))+int(item.get('java'))
                                 ))


def delete():
    while True:
        student_id=input('請(qǐng)輸入要?jiǎng)h除的學(xué)生的ID:')
        if student_id!='':
            if os.path.exists(filename):
                with open(filename,'r',encoding='utf-8') as file:
                    student_old=file.readlines()
            else:
                student_old=[]
            flag=False #刪除標(biāo)記
            if student_old:
                with open(filename,'w',encoding='utf-8') as wfile:
                    d={}
                    for item in student_old:
                        d=dict(eval(item)) #將字符串轉(zhuǎn)字典
                        if d['id']!=student_id:
                            wfile.write(str(d)+'\n')
                        else:
                            flag=True
                    if flag:
                        print(f'id為{student_id}的學(xué)生信息已被刪除')
                    else:
                        print(f'沒有找到ID為{student_id}的學(xué)生信息')
            else:
                print('無學(xué)生信息')
                break
            show() #刪除之后要重新顯示所有學(xué)生信息
            answer=input('是否繼續(xù)刪除?y/n')
            if answer.lower()=='y':
                continue
            else:
                break

def modify():
    show()
    if os.path.exists(filename):
        with open(filename,'r',encoding='utf-8') as rfile:
            student_old=rfile.readlines()
    else:
        return
    student_id=input('請(qǐng)輸入要修改的學(xué)員的ID:')
    with open(filename,'w',encoding='utf-8') as wfile:
        for item in student_old:
            d=dict(eval(item))
            if d['id']==student_id:
                print('找到學(xué)生信息,可以修改他的相關(guān)信息了!')
                while True:
                    try:
                        d['name']=input('請(qǐng)輸入姓名:')
                        d['english']=input('請(qǐng)輸入英語成績(jī):')
                        d['python']=input('請(qǐng)輸入python成績(jī):')
                        d['java']=input('請(qǐng)輸入java成績(jī):')
                    except:
                        print('您的輸入有誤,請(qǐng)重新輸入!!!')
                    else:
                        break
                wfile.write(str(d)+'\n')
                print('修改成功!')
                show()
            else:
                print(f'未找到ID為{student_id}的學(xué)生信息')
                wfile.write(str(d)+'\n')
        answer=input('是否繼續(xù)修改其他學(xué)生信息?y/n\n')
        if answer.lower()=='y':
            modify()

def sort():
    show()
    if os.path.exists(filename):
        with open(filename,'r',encoding='utf-8') as rfile:
            student_list=rfile.readlines()
        student_new=[]
        for item in student_list:
            d=dict(eval(item))
            student_new.append(d)

    else:
        return
    asc_or_desc=input('請(qǐng)選擇(0.升序,1.降序):')
    if asc_or_desc=='0':
        asc_or_desc_bool=False
    elif asc_or_desc=='1':
        asc_or_desc_bool=True
    else:
        print('您的輸入有誤,請(qǐng)重新輸入')
        sort()
    mode=input('請(qǐng)選擇排序方式(1.按英語成績(jī)排序 2.按Python成績(jī)排序 3.按Java成績(jī)排序 4.按總成績(jī)排序)')
    if mode=='1':
        student_new.sort(key=lambda x:int(x['english']),reverse=asc_or_desc_bool)
    elif mode=='2':
        student_new.sort(key=lambda x:int(x['python']),reverse=asc_or_desc_bool)
    elif mode=='3':
        student_new.sort(key=lambda x:int(x['java']),reverse=asc_or_desc_bool)
    elif mode=='4':
        student_new.sort(key=lambda x:int(x['english'])+int(x['python'])+int(x['java']),reverse=asc_or_desc_bool)
    else:
        print('您的輸入有誤,請(qǐng)重新輸入')
        sort()
    show_student(student_new)
def total():
    if os.path.exists(filename):
        with open(filename,'r',encoding='utf-8') as rfile:
            students=rfile.readlines()
            if students:
                print(f'一共有{len(students)}名學(xué)生')
            else:
                print('還沒有錄入學(xué)生信息')
    else:
        print('暫未保存數(shù)據(jù)信息...')
def show():
    student_list = []
    if os.path.exists(filename):
        # 定義標(biāo)題顯示格式
        format_title = '{:^6}\t{:^12}\t{:^8}\t{:^10}\t{:^10}\t{:^8}\t'
        print(format_title.format('ID', '姓名', '英語成績(jī)', 'Python成績(jī)', 'Java成績(jī)', '總成績(jī)'))
        with open(filename,'r',encoding='utf-8') as rfile:
            student = rfile.readlines()
            for item in student:
                d = dict(eval(item))
                student_list.append(d)
        if len(student_list)==0:
            format_nodata = '{:^6}'
            print(format_nodata.format('無數(shù)據(jù)'))
        # 定義內(nèi)容顯示格式
        format_data = '{:^6}\t{:^12}\t{:^8}\t{:^8}\t{:^8}\t{:^8}\t'
        for item in student_list:
            print(format_data.format(item.get('id'),
                                    item.get('name'),
                                    item.get('english'),
                                    item.get('python'),
                                    item.get('java'),
                                    int(item.get('english')) + int(item.get('python')) + int(item.get('java'))
                                    ))
        student_list.clear()
    else:
        print('暫未保存過數(shù)據(jù)!!!')


if __name__ == '__main__':
    main()

到了這里,關(guān)于python學(xué)習(xí)-學(xué)生信息管理系統(tǒng)并打包exe的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 基于Python的學(xué)生信息管理系統(tǒng)

    注意,該項(xiàng)目為Python基礎(chǔ)語法的一個(gè)綜合,項(xiàng)目數(shù)據(jù)庫。 ?

    2023年04月11日
    瀏覽(21)
  • 基于python的簡(jiǎn)單學(xué)生信息管理系統(tǒng)

    基于python的簡(jiǎn)單學(xué)生信息管理系統(tǒng)

    針對(duì)傳統(tǒng)的學(xué)生信息管理方式,效率低下,不易存儲(chǔ),和數(shù)字化等問題,開發(fā)基于 Python 的學(xué)生信息管理系統(tǒng),用于管理學(xué)生的個(gè)人信息和學(xué)習(xí)記錄。它可以幫助教師和管理員更有效地管理學(xué)生信息,如學(xué)生基本信息、成績(jī)、課程安排、考試記錄等。同時(shí),信息化、數(shù)字化的

    2024年02月05日
    瀏覽(21)
  • Python課程設(shè)計(jì)之學(xué)生信息管理系統(tǒng)

    Python課程設(shè)計(jì)之學(xué)生信息管理系統(tǒng)

    核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 核心代碼 運(yùn)行效果 點(diǎn)擊下載

    2024年02月11日
    瀏覽(28)
  • python基于Tkinter實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)

    python基于Tkinter實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)

    1.添加學(xué)生成績(jī):管理員可以在系統(tǒng)中添加學(xué)生的成績(jī)信息,包括學(xué)生姓名、學(xué)號(hào)、課程名稱、成績(jī)等。 2.刪除學(xué)生成績(jī):管理員可以根據(jù)學(xué)生的學(xué)號(hào)或者姓名刪除學(xué)生的成績(jī)信息。 3.修改學(xué)生成績(jī):管理員可以修改學(xué)生的成績(jī)信息,包括學(xué)生姓名、學(xué)號(hào)、課程名稱、成績(jī)等

    2024年02月08日
    瀏覽(20)
  • Python項(xiàng)目開發(fā)案例————學(xué)生信息管理系統(tǒng)(附源碼)

    Python項(xiàng)目開發(fā)案例————學(xué)生信息管理系統(tǒng)(附源碼)

    ? ? ? ? ? 本文使用Python語言開發(fā)了一個(gè)學(xué)生信息管理系統(tǒng),該系統(tǒng)可以幫助教師快速錄入學(xué)生的信息,并且對(duì)學(xué)生的信息進(jìn)行基本的增、刪、改、查操作;還可以實(shí)時(shí)地將學(xué)生的信息保存到磁盤文件中。 ? ? ? ? 為了順應(yīng)互聯(lián)網(wǎng)時(shí)代用戶的獲取數(shù)據(jù)需求,學(xué)生信息管理系統(tǒng)

    2024年02月11日
    瀏覽(25)
  • 基于python的學(xué)生信息管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)

    小白學(xué)python,做了一個(gè)基礎(chǔ)小系統(tǒng),給大家分享一下(歡迎大神指導(dǎo)) 目錄 步驟 1.設(shè)計(jì)要求 2.設(shè)計(jì)步驟 (1)導(dǎo)入os模塊,創(chuàng)建一個(gè)文件夾用于存儲(chǔ)數(shù)據(jù) ?(2)定義一個(gè)菜單函數(shù) (3)實(shí)現(xiàn)學(xué)生信息的錄入功能 (4)定義了一個(gè)save函數(shù)用于錄入功能的調(diào)用 (5)查詢功能的實(shí)現(xiàn)

    2024年02月09日
    瀏覽(19)
  • 免費(fèi)分享一套PyQt6學(xué)生信息管理系統(tǒng) Python管理系統(tǒng) Python源碼,挺漂亮的

    免費(fèi)分享一套PyQt6學(xué)生信息管理系統(tǒng) Python管理系統(tǒng) Python源碼,挺漂亮的

    大家好,我是java1234_小鋒老師,看到一個(gè)不錯(cuò)的PyQt6學(xué)生信息管理系統(tǒng) Python管理系統(tǒng) Python源碼,分享下哈。 【免費(fèi)】PyQt5 學(xué)生信息管理系統(tǒng) Python管理系統(tǒng) Python源碼 Python畢業(yè)設(shè)計(jì)_嗶哩嗶哩_bilibili 【免費(fèi)】PyQt5 學(xué)生信息管理系統(tǒng) Python管理系統(tǒng) Python源碼 Python畢業(yè)設(shè)計(jì)項(xiàng)目來自

    2024年02月03日
    瀏覽(27)
  • Python實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)V3.0(GUI界面)

    Python實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)V3.0(GUI界面)

    關(guān)于“學(xué)生信息管理系統(tǒng)”的基本思路和詳細(xì)過程,請(qǐng)看V1.0版本: Python實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)V1.0_︶ㄣ釋然的博客-CSDN博客 本文是關(guān)于學(xué)生信息管理系統(tǒng)的簡(jiǎn)易版以及具體內(nèi)容具體思路的詳細(xì)講解,簡(jiǎn)單易理解、純邏輯實(shí)現(xiàn)、沒有復(fù)雜的第三方庫,適合新手小白練手 https:/

    2024年02月09日
    瀏覽(18)
  • 基于Python guI的學(xué)生信息管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)

    基于Python guI的學(xué)生信息管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)

    ????????講述的是一個(gè)使用Python GUI的學(xué)習(xí)資料管理工具。通過使用Python的Tkinter庫和mysql數(shù)據(jù)庫,這個(gè)工具可以方便地記錄、檢索、更新學(xué)習(xí)資料。本文詳細(xì)描述了系統(tǒng)的架構(gòu)設(shè)計(jì)和實(shí)現(xiàn)過程,并對(duì)系統(tǒng)進(jìn)行了功能測(cè)試和性能測(cè)試。結(jié)果表明,該系統(tǒng)具有良好的用戶界面和

    2024年02月03日
    瀏覽(19)
  • 學(xué)生信息及成績(jī)管理系統(tǒng)(Python+Sqlite)數(shù)據(jù)庫版

    學(xué)生信息及成績(jī)管理系統(tǒng)(Python+Sqlite)數(shù)據(jù)庫版

    目錄 功能模塊: 運(yùn)行功能演示: ?具體代碼實(shí)現(xiàn)過程: 創(chuàng)建sqlite?數(shù)據(jù)庫 ?Python代碼 引入os和sqlite3包: 初始化數(shù)據(jù)庫: 連接數(shù)據(jù)庫: 關(guān)閉并提交數(shù)據(jù)到數(shù)據(jù)庫: 查詢數(shù)據(jù)并顯示: 添加并插入數(shù)據(jù)到數(shù)據(jù)庫: 更新數(shù)據(jù)到數(shù)據(jù)庫: 刪除數(shù)據(jù)并更新數(shù)據(jù)庫: ?導(dǎo)入和導(dǎo)出數(shù)據(jù)

    2024年02月04日
    瀏覽(40)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包