最后这一步,就是格式化信息,它显示我keyerror是 No,但我和老师打得一样啊
来源:3-13 字典在项目中的应用
TeacherZhe
2020-03-20 19:23:15
info = input("Please input the number:") single_info = all_dict[info] print(single_info) print("Employee's name is {No.}, {name}, is from {depart}, and his/her current salary is {salary}".format_map(single_info))
1回答
同学,你好。格式化{No.}时,是不能加符号“.”的,因为format格式化的“.”有其他含义,老师的{No.}也是没有符号“.”的,建议同学改成{No}进行输出。
如果解决了你的疑惑,请采纳,祝学习愉快~
相似问题