# Script bien meilleur

from unidecode import unidecode
import time
from itertools import permutations 

def anagrammes(mot):
    mot = mot.upper()
    M = []
    A = [''.join(list(i)) for i in permutations(mot) ]
    
    # on construit une liste des mots de même longueur que 'mot'
    
    with open('mots.txt' , 'r' , encoding='utf-8') as w:
        for l in w:
            if len(l[:-1]) == len(mot) and unidecode(l[:-1]) not in M:
                M.append(unidecode(l[:-1]))
    
    L = [ word for word in M if word in A]
        
    return L

start = time.time()
print( anagrammes('python') )
end = time.time()
print(end - start)
