[Solved] Need to change letters to other letters (Python 2.7)


something like this?

orig = 'hello'
# table = {'h': 'L', 'e': 'O', 'l': 'A', 'o': 'W' }
# table_tr = dict( (ord(a), ord(b))  for a,b in table.items() ) 
table_tr = str.maketrans('helo', 'LOAW')
res = orig.translate(table_tr)
print(res)

(this is for python3; for python2 you need to import string and use string.maketrans)

solved Need to change letters to other letters (Python 2.7)