Created
February 27, 2014 19:03
-
-
Save zeldani/9256826 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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