string = 'some string' normal_alphabet = 'abcdefghijklmnopqrstuvwxyz.' my_alphabet = 'ijklmnopqrstuvwxyz.abcdefgh' translation = string.maketrans(normal_alphabet, my_alphabet) print(string.translate(translation))
Here is what the above code is Doing:
1. We create a normal alphabet and a my alphabet.
2. We create a translation table using the maketrans function.
3. We translate the string using the translate function.