[Tutor] Eng to Leet Speek
Alan Gauld
alan.gauld at btinternet.com
Mon Jul 27 22:02:34 CEST 2009
"Chris Castillo" <ctcast at gmail.com> wrote
> and I am trying to turn it into english with the following code:
>
> def eng2leet(astring):
> astring = astring.replace("4","a")
> astring = astring.replace("8","b")
> astring = astring.replace("[","c")
> astring = astring.replace("|)","d")
You might want to investigate the maketrans and translate
functions in the string module.
The seem to be quite similar in intent to what you are trying
to do?
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list