题解 | #简单错误记录#
简单错误记录
https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
import sys records = [] dic = dict() for line in sys.stdin: file_and_line = line.split("\\")[-1].split(" ") address = file_and_line[0][-16:] # last 16 characters line = file_and_line[1][:-1] # ditch "\n" key = address + " " + line if key not in dic: dic[key] = 1 records.append(key) else: dic[key] += 1 if len(records) > 8: records.pop(0) for record in records: print(record + " " + str(dic[record]))18行python3代码 简单易懂 这题不配当hard