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('请输入要修改的学员的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('找到学生信息,可以修改他的相关信息了!')
while True:
try:
d['name'] = input('请输入姓名:')
d['english'] = input('请输入英语成绩:')
d['python'] = input('请输入python成绩:')
d['java'] = input('请输入java成绩:')
except:
print('您的输入有误,请重新输入')
else:
break
wfile.write(str(d) + '\n')
print('修改成功!!!')
else:
wfile.write(str(d) + '\t')
4 修改 7777777777
最新推荐文章于 2024-05-23 09:46:55 发布