Python Maketrans() Function
Easy Caesar Cypher encrypt and decrypt using maketrans function in python 2 and 3.
Below are simple example of using maketrans in Python 2. You need to import the library before using the function. If you are using Python 3, just omit the import step. It will give you the same output.
from string import maketrans
def trans(a): alphabet = "abcdefghijklmnopqrstuvwxyz" key = "cdefghijklmnopqrstuvwxyzab" translator = maketrans(alphabet, key) return a.translate(translator)











