十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
#处理员工数据
source = "7782,clark,manager,sales,5000$7934,miller,salesman,sales,3000"
source1 = source.split("$")
print(source1)
#保存所有解析后的员工信息,key是员工编号,value是信息
all_emp = {}
for i in range(0,len(source1)):
e=source1[i].split(",")
print(e)
#创建员工字典
employe = {'no':e[0],'name':e[1],'job':e[2],'department':e[3],'salary':e[4]}
print(employe)
all_emp[employe['no']]=employe
print(all_emp)
while True:
empno = input("请输入员工编号: ")
if empno in all_emp:
emp = all_emp.get(empno)
print("工号:{no},姓名:{name},岗位:{job},部门:{department},工资:{salary}".format_map(emp))
else:
print("请输入正确的工号")