On Tue, Jan 7, 2014 at 3:24 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > If you don't want to use the codec, you can do it by hand: > > def rot13(astring): > result = [] > for c in astring: > i = ord(c) > if ord('a') <= i <= ord('m') or ord('A') <= i <= ord('M'): > i += 13 > elif ord('n') <= i <= ord('z') or ord('N') <= i <= ord('Z'): > i -= 13 > result.append(chr(i)) > return ''.join(result) > > But why would you want to do it the slow way?
Eww. I'd much rather use .translate() than that :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list