with open(r'C:\Users\Administrator\Desktop\Q2_2.txt', 'r') as f2:
dict_line = {}
for line1 in f2.readlines():
line1 = line1.rstrip()
count_line = 0
if line1 not in dict_line.keys():
for line2 in f2.readlines():
line2 = line2.rstrip()
if line1 == line2:
count_line += 1
dict_line[line1] = count_line
print(dict_line)
with open(r'C:\Users\Administrator\Desktop\Q2_3.txt', 'w') as f3:
f3.write(str(dict_line))
f3.close()
f2.close()
蝴蝶不菲
繁花不似锦
相关分类