Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- counter_dict = {}
- with open('D:\\python\\name.txt') as f:
- line = f.readline()
- while line:
- line = line.strip()
- if line in counter_dict:
- counter_dict[line] +=1
- else:
- counter_dict[line] = 1
- line = f.readline()
- print(counter_dict)
Add Comment
Please, Sign In to add comment