Select Git revision
CSE16237_Ex03_q2.py
CSE16237_Ex03_q2.py 354 B
path='/home/student4/sun.txt'
sun_file=open(path,'r')
categories = {}
line = sun_file.readline().strip().split("/sun_")
category = line[0][3:]
while len(category)>0:
if category in categories.keys():
categories[category]+=1
else:
categories[category]=1
line = sun_file.readline().strip().split("/sun_")
category = line[0][3:]
print(categories)