人力资源:创建一个简单的雇员姓名和编号的程序。让用户输入一组雇员姓名和编号。程序可以提供姓名排序输出的功能,名字在前编号在后,
#!/usr/bin/env python
#coding=utf-8"""screen_width = 8
text_width = len(sentence)
box_width = text_width + 6
lenft_margin = (screen_width - box_windth) // 2 """
do = raw_input("what do you want to do?\na:<add> \nq:<exit>\n c:<list>")
a = {}
def hanshu():
if do == "a":
user = raw_input("please input username:\n")
password = raw_input("please input nameder\n")
a.update({user:password})
def tou():
h = raw_input("if you want continue,please input c,or input q!\n")
if h == "q":
print"bey-bye\n"
elif h == "c":
hanshu()
else:
print "you's input error!please input agin!\n"
tou()
tou()
else:
print"beybey\n"
hanshu()
i = sorted(a.items(),key=lambda item:item[1])
print "-------------------------------------"
for p,q in i:
print p,q
~