题解 | #简单错误记录#
简单错误记录
https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
import sys
import re
res = {}
for line in sys.stdin:
# path,id = line.strip().split(' ')
path = line.strip().split('\\')[-1]##\\转译\
path = path[-20:]##截取字符串后20位
if path not in res:
res[path]=0
res[path]+=1
for line in list(res.keys())[-8:]:##字典的索引方式,key转化为list之后进行索引
path,id = line.strip().split(' ')
print(path,id,res[line])
