Facebook
From Inspecteur Le Blanko, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from Inspecteur Le Blanko - view diff
Embed
Download Paste or View Raw
Hits: 102
  1. def create_dictionary(filename) :
  2.     d = {}
  3.     f = open(filename)
  4.     for line in f :
  5.         word = line.strip("\n")
  6.         try :
  7.             value = d[word]
  8.             valueN = value + 1
  9.             d[word] = valueN
  10.         except :
  11.             d[word] = 1
  12.            
  13.            
  14.     return d
  15.  
  16.  
  17. def occ(dictionnary, word) :
  18.     occ = dictionnary[word]
  19.     return occ