alfabeto = {'t':0, 's':1, 'h':2, 'j':3, 'm':4, 'p':5, 'n':6, 'z':7, 'w':8, 'l':9, 'r':10, ' c':11, 'b':12, 'x':13, 'k':14, 'q':15, 'v':16, 'd':17, 'g':18, 'f':19}
d = open('txtA.txt', 'r')
ordenar = []
for line in d:
for word in line.split():
if word not in ordenar:
ordenar.append(word)
for c in ordenar:
for i in c:
ordenado = sorted(line.split(), key=(alfabeto.get(i, ord(i))))
print(ordenado)
This is a code to sort a text in a custom way, but it is not running.
The following error appears:
TypeError: 'int' object is not callable
And I do not understand why.