首页 > 代码库 > HR_sorted_logon
HR_sorted_logon
#!/usr/bin/env python #coding:utf-8 ‘‘‘ Program: sorted the name inputed and output by number History: 2017.03.29 Mr.liu First release ‘‘‘ li = [] count = 0 while count < 100: print "Up to 100 employees information input,and %d employee(s) already input.\n(Please input ‘ending‘ if input finish) )" %(count) name = raw_input(" Please input the message of employees(like: name,number):") if "," in name and "," != name[0] and name.index(",") != len(name) - 1 and name.count(",") == 1: li.append(name) count += 1 elif name == "ending": break else: name =raw_input("Unknown message! Please try again:") li.append(name) count += 1 else: li = sorted(li) print "Employee information sheet is as follows (sorted by name):" for i in li: print i li = sorted(li, key=lambda d : int(d.split(‘,‘)[-1])) print "Employee information sheet is as follows (sorted by number):" for i in li: print i
本文出自 “12449513” 博客,请务必保留此出处http://12459513.blog.51cto.com/12449513/1911539
HR_sorted_logon
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。