#
emp_list = []
while True:
info = input("请输入员工信息:")
if info == "":
print("程序结束")#输入回车时结束
break
info_list = info.split(",")
print(len(info_list))
if len(info_list) != 3:
print("格式不正确,只能输入三段")
continue
emp_list.append(info_list)
print(emp_list)
for emp in emp_list:
print("姓名: {n},年龄:{a},工资:{s}".format(n=emp[0],a=emp[1],s=emp[2]))``
原文地址:https://blog.51cto.com/10805472/2456949
时间: 2024-11-05 23:30:29