[Tutor] Eng to Leet Speek

Chris Castillo ctcast at gmail.com
Mon Jul 27 20:51:39 CEST 2009


On Mon, Jul 27, 2009 at 1:38 PM, J Sisson <sisson.j at gmail.com> wrote:

> You need a deterministic algorithm for conversion.  It's impossible
> (without analyzing the context of the word) to translate "|_|#" (it's either
> "lf" or "uh", but which?).
>
>
>
>
> On Mon, Jul 27, 2009 at 1:13 PM, Chris Castillo <ctcast at gmail.com> wrote:
>
>> so I have a string:
>>
>> 1 4|-| 50 |_33+.  I love [#ick3n 4nd ch3353.  Don't you love +|_|2|\e7
>> \/\/1+# the |#a|-|i|_7?
>>
>>
>> and I am trying to turn it into english with the following code:
>>
>> fileIn = open("encrypted.txt", "r").read()
>>
>> def eng2leet(astring):
>>     astring = astring.replace("4","a")
>>     astring = astring.replace("8","b")
>>     astring = astring.replace("[","c")
>>     astring = astring.replace("|)","d")
>>     astring = astring.replace("3","e")
>>     astring = astring.replace("|#","f")
>>     astring = astring.replace("6","g")
>>     astring = astring.replace("#","h")
>>     astring = astring.replace("1","i")
>>     astring = astring.replace("]","j")
>>     astring = astring.replace("|\\","k")
>>     astring = astring.replace("|_","l")
>>     astring = astring.replace("|-|","m")
>>     astring = astring.replace("|\\","n")
>>     astring = astring.replace("0","o")
>>     astring = astring.replace("|*","p")
>>     astring = astring.replace("0\\","q")
>>     astring = astring.replace("2","r")
>>     astring = astring.replace("5","s")
>>     astring = astring.replace("+","t")
>>     astring = astring.replace("|_|","u")
>>     astring = astring.replace("\/","v")
>>     astring = astring.replace("\/\/","w")
>>     astring = astring.replace("><","x")
>>     astring = astring.replace("7","y")
>>     astring = astring.replace("7_","z")
>>     return astring
>>
>> print eng2leet(fileIn)
>>
>> Only problem is that when it needs to translate a U or a W it prints an L
>> or 2 V's. Need some help please. Thanks
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>
>
> --
> Computers are like air conditioners...
> They quit working when you open Windows.



so is their some other way to go about this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090727/a77d0119/attachment-0001.htm>


More information about the Tutor mailing list