path='/home/student4/sw.txt' sw_file=open(path,'s') e={} occ=sw_file.readlines() for j in occ: if j in d: d[j]+=1 else: d[j]=1 print(e)