xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 6KB
    文件類型: .py
    金幣: 1
    下載: 2 次
    發布日期: 2021-06-18
  • 語言: Python
  • 標簽: 數據??

資源簡介

用簡單的Python代碼實現學生管理系統,連接數據庫實現增刪改查

資源截圖

代碼片段和文件信息

import?sqlite3
import?sys
import?re
def?Prtstu():
??stulist=c.execute(“select?*?from?stu“)
??for?s?in?stulist:
????print(s)
def?Addstu():
??newname=input(“輸入姓名“)
??
??while?True:
????????num=input(“輸入學號“)
????????p=re.compile(r‘\d{9}$‘)
????????if?p.match(num):
????????????break
????????else:
????????????print(“輸入錯誤,必需是9位數字“)
??while?True:
????????newscore=int(input(“輸入成績“))
????????if?newscore>=0?and?newscore<=100:
????????????break
????????else:
????????????print(“輸入錯誤,必需是0-100之間的數字“)??
??save=input(“是否保存數據?Y/N“)
??if?save.upper()==“Y“:
???????c.execute(“insert?into?stu?values(???)“(numnewnamenewscore))
???????con.commit()
???????print(“保存數據成功!“)
def?Sbynum():
????inputnum=input(“請輸入要查找的學號:“)
????c.execute(“select?*?from?stu?where??學號=?“(inputnum))
????print(c.fetchone())
????
def?Sbyname():
????inputname=input(“請輸入要查找的姓名:“)
????c.execute(“select?*?from?stu?where??學號=?“(inputname))
????print(c.fetchone())
def?Searchstu():
????print(“*****************************************“)
????print(“----------------菜單---------------------“)
????print(“根據學號查找----------------------------1“)
????print(“根據姓名查找----------------------------2“)
????print(“離開本模塊------------------------------3“)
????print(“*****************************************“)
????sc=input(“請輸入你的選擇“)
????if?sc==“1“:
????????Sbynum()
????elif?sc==“2“:
????????Sbyname()
????elif?sc==“3“:
????????Mainmenu()
????else:
????????print(“你的輸入有誤!“)
def?Dbynum():
????x=Sbynum()
????if?x!=-1:
????????save=input(“是否保存Y/y“)
????????if?save.upper()==“Y“:
????????????stulist.remove(x)
????????????f=open(“students.txt““w“)
????????????for?s?in?stulist:????????????????
????????????????str1=s.num+“??“+s.name+“???“+str(s.cj)+“??“+“\n“
????????????????f.write(str1)
????????????print(“保存成功!“)
def?Dbyname():
????x=Sbyname()
????if?x!=-1:
????????save=input(“是否保存Y/y“)
????????if?save.upper()==“Y“:
????????????stulist.remove(x)
????????????f=open(“students.txt““w“)
????????????for?s?in?stulist:????????????????
????????????????str1=s.num+“??“+s.name+“???“+str(s.cj)+“??“+“\n“
????????????????f.write(str1)
????????????print(“保存成功!“)????????????
def??Sortstu():
????pxlist=sorted(key=lambda?x:x.cj)
????Prtstu(pxlist)
def?Delstu():
????print(“*****************************************“)
????print(“----------------菜單---------------------“)
????print(“根據學號刪除----------------------------1“)
????print(“根據姓名刪除----------------------------2“)
????print(“離開本模塊------------------------------3“)
????print(“*****************************************“)
????sc=input(“請輸入你的選擇“)
????if?sc==

評論

共有 條評論