题解 | #简单错误记录#
简单错误记录
https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
final_dict ={} while True: try: input_str = input() # 接受输入的错误记录 file_path,row_number = input_str.split(' ') filename=file_path.split("\\")[-1][-16:] file_log=filename + " " + row_number print(file_log) if file_log not in final_dict.keys(): final_dict[file_log] = 1 elif file_log in final_dict.keys(): final_dict[file_log] += 1 except: break final_list =[] for i, (k, v) in enumerate(final_dict.items()): final_list.append(k+' '+str(v)) for i in final_list[-8:]: print(i)
#华为机试#