'''
@Author: your name
@Date: 2020-07-11 23:15:21
@LastEditTime: 2020-07-11 23:44:30
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: \vscode_py\day6.py
'''
# Question18:
# 检验密码的格式是否复合规则
import re
def Q18():
res=[]
pass_words=input().split(",")
for pass_word in pass_words:
count=0
if len(pass_word)>=6 and len(pass_word)<=12:
count+=bool(re.search("[a-z]",pass_word))
count+=bool(re.search("[A-Z]",pass_word))
count+=bool(re.search("[0-9]",pass_word))
count+=bool(re.search("[@#$]",pass_word))
else:
continue
if count==4:
res.append(pass_word)
print(",".join(res))
# Question19:
# 对tuples 排序,name>age>score,升序
# from operator import itemgetter, attrgetter
def Q19():
lst =[]
while True:
person=input().split(",")
if not person[0]:
break
lst.append(tuple(person)) # []--->()
print(lst)
# lst.sort(key=itemgetter(0,1,2))
lst.sort(key= lambda x:(x[0],x[1],x[2])) # 使用lambda进行排序
print(lst)
if __name__ == "__main__":
# Q18()
Q19()