Facebook
From Inspecteur Le Blanko, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from Inspecteur Le Blanko - go back
Embed
Viewing differences between Untitled and Re: Untitled
def create_dictionary(filename) : #marche sur thonny mais pas ici ??
:
    d = {}
    f = open(filename)
    for line in f :
        word = line.strip("\n")
        try :
            value = d[word]
            valueN = value + 1
            d[word] = valueN
        except :
            d[word] = 1
            
            
    return d


def occ(dictionnary, word) :
    occ = dictionnary[word]
    return occ