Guest User

Untitled

a guest
Jan 15th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. counter_dict = {}
  2.  
  3. with open('D:\\python\\name.txt') as f:
  4. line = f.readline()
  5.  
  6. while line:
  7. line = line.strip()
  8.  
  9. if line in counter_dict:
  10. counter_dict[line] +=1
  11. else:
  12. counter_dict[line] = 1
  13. line = f.readline()
  14.  
  15. print(counter_dict)
Add Comment
Please, Sign In to add comment