Skip to content
Snippets Groups Projects
Commit c270cbf8 authored by aslesha's avatar aslesha
Browse files

Upload New File

parent 0313fc1d
No related branches found
No related tags found
No related merge requests found
Pipeline #167 canceled
d = {}
fname = input("Enter the name of the file:")
with open(fname, 'r') as f:
line = f.readline()
while line:
line = line.strip()
end = line.find('/', 3)
category = line[3: end]
if category not in d:
d[category] = 0
d[category] = d[category] + 1
line = f.readline()
for (category,cnt) in d.items():
print(category, cnt)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment