本博客为个人整理Python学习帖,python 基础的结课作业,如有错误,感谢指正。系统学习,欢迎持续关注,后续会涉及自动化办公,爬虫,python大数据,算法,人工智能基础—对接AI。欢迎关注,python基础阶段结束,会更新AIOT相关博客,欢迎大家讨论相关AIOT技术,如有大佬愿意加入团队,欢迎私信。
"""
@author:想泡罗敷的马同学
@Email: mqa010225@163.com
@file:stuSystem.py
@time:2021/07/17/
"""
import os
filename = 'student.txt'
def main():
while True:
menu()
choice = int(input('Please,choice!'))
if choice in [0, 1, 2, 3, 4, 5, 6, 7]:
if choice == 0:
answer = input('Are you sure?y/n')
if answer == 'y' or answer == 'Y':
print('Thanks for your use,bye!')
break
else:
continue
elif choice == 1:
insert() # 录入学生信息
elif choice == 2:
search()
elif choice == 3:
delete()
elif choice == 4:
modify()
elif choice == 5:
sort()
elif choice == 6:
total()
elif choice == 7:
show()
else:
continue
def menu():
print('=======================stuSystem=======================')
print('=========================menu==========================')
print('\t\t\t\t\t\t1.录入学生信息')
print('\t\t\t\t\t\t2.查找学生信息')
print('\t\t\t\t\t\t3.删除学生')
print('\t\t\t\t\t\t4.修改学生信息')
print('\t\t\t\t\t\t5.排序')
print('\t\t\t\t\t\t6.统计学生信息')
print('\t\t\t\t\t\t7.显示学生信息')
print('\t\t\t\t\t\t0.退出')
print('-------------------------------------------------------')
def insert():
student_list = []
while True:
id = input('Please input stuID(like 1001):')
if not id:
break
name = input('Please input stuName:')
if not name:
break
try:
english = int(input('please input english score:'))
python = int(input('please input python score:')