How to ROT13 encode in Python3?
In Python 3.2+, there is rot_13
str-to-str codec:
import codecs
print(codecs.encode("hello", "rot-13")) # -> uryyb
Aha! I thought it had been dropped from Python 3, but no - it is just that the interface has changed, because a codec has to return bytes (and this is str-to-str).
This is from http://www.wefearchange.org/2012/01/python-3-porting-fun-redux.html :
import codecs
s = "hello"
enc = codecs.getencoder( "rot-13" )
os = enc( s )[0]