How do I do a Rot13?

Kalle Svensson kalle at lysator.liu.se
Mon Oct 28 00:47:19 CET 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[John Draper]
> How do I write a function to do a "rot13" to a string?
> Do I have to do this character-by-character or is there a translate
> function which will do this for me?

A char-by-char approach might be the most clear, but using the
functions translate and maketrans in the string module is an option.
A bonus is that it's probably faster.

Peace,
  Kalle
- -- 
Kalle Svensson, http://www.juckapan.org/~kalle/
Student, root and saint in the Church of Emacs.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>

iD8DBQE9vHsDdNeA1787sd0RAvCdAKDOK1PkeRDheVjF77JG3r1wt7RKPACgxKxf
K0Axe/p9xziRWtWy3YFxkbc=
=xGV0
-----END PGP SIGNATURE-----




More information about the Python-list mailing list