题解 | #日志排序#
日志排序
https://www.nowcoder.com/practice/0f64518fea254c0187ccf0ea05019672
datas = [] while True: try: line = input().strip() if not line: break datas.append(line) except EOFError: break def sort_key(line): parts = line.split() num = float(parts[-1][:-3]) other_parts = parts[1:3] return num, other_parts datas.sort(key=sort_key) for i in datas: print(i)