题解 | #简单错误记录#
简单错误记录
https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
dic, val = {}, {} keys = [] coun = 0 while True: add = [] try: s = input() tt = s.split(" ") dizhi = tt[0].split("\\") num = tt[1] # print("--------") #print(num) dd = dizhi[-1] ddd = dd[-16:] # print(dd[-16:]) vvv = [ddd, num] vvv_1 = " ".join(vvv) # print(vvv_1) if vvv_1 in dic.keys(): dic[vvv_1] += 1 # 如果存在,其值加1 coun += 1 else: dic[vvv_1] = 1 #将地址和行号作为一个键值,计数为1 coun += 1 except: break count = 0 """ for k in reversed(dic.keys()): v = dic[k] for i in range(len(v)): print(k, (v[i])[0], (v[i])[1]) count += 1 if count == 8: break """ key_add = list(dic.keys()) # print("----------------------------------") if coun > 8: kyyy = key_add[-8:] for u in kyyy: v_1 = dic[u] #for i in range(len(v_1)): print(u, (v_1)) else: for k in (dic.keys()): v = dic[k] print(k, v)