应该是这个代码出错了,但我怎么都检查不出来:
def show_student(lst):
if len(lst) == 0:
print('没有查询到学生信息,无数据显示!!!')
return
# 定义标题的显示格式
format_title = '{:^6}\t{:^12}\t{:^8}\t{:^10}\t{:^10}\t{:^8}'
print(format_title.format('ID', '姓名', '英语成绩', 'python成绩', 'java成绩', '总成绩'))
# 定义内容的显示格式
format_date = '{:^6}\t{:^12}\t{:^8}\t{:^8}\t{:^8}\t{:^8}'
for item in lst:
print(format_date.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'))
))
Traceback (most recent call last):
File "D:\python practice\studentsys\stusystem.py", line 247, in <module>
main()
File "D:\python practice\studentsys\stusystem.py", line 23, in main
search()
File "D:\python practice\studentsys\stusystem.py", line 109, in search
d = dict(eval(item))
File "<string>", line 1
^
SyntaxError: unexpected EOF while parsing
Process finished with exit code 1
