Skip to content

Instantly share code, notes, and snippets.

@zeldani
Created February 27, 2014 19:03
Show Gist options
  • Save zeldani/9256826 to your computer and use it in GitHub Desktop.
Save zeldani/9256826 to your computer and use it in GitHub Desktop.
# Exemplo 01:
import codecs
texto1 = codecs.encode("dado para ser codificado", "rot13")
print texto1
# Exemplo 02:
texto2 ='dado para ser codificado'
print texto2.encode('rot-13')
# Exemplo 03:
from string import maketrans
rot13_trans = maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm')
texto3 = 'dado para ser codificado'
print texto3.translate(rot13_trans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment