Obtaining the ROT13 encoding of a string used to be easy in Python 2.x:
s = "Hello" os = s.encode( "rot13" ) print( os ) # "Uryyb"
This no longer works in Python 3.x. The solution that works in Python 3.x is to access low-level functions in the codecs module:
import codecs s = "Hello" enc = codecs.getencoder( "rot-13" ) os = enc( s ) print( os ) # "Uryyb"
Tried with: Python 3.2.3