Python Forum

Full Version: py7h0n -> python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I am looking for an easy way to recognize special characters in a word as normal characters (as in the description)!

another example would be p@$sw0rd -> password.

Are there any libraries already available for this?
for start have a look at string.translate() and string.maketrans()
you will need to create the translation table yourself.
you can try 
https://github.com/floft/leetspeak

It seems to work with basic and advanced leet speak. It only got the one password one wrong
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "d1c710n4ry"
dictionary
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "p@$sw0rd"
pa
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "py7h0n"
python
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "5h4k35p34r3"
shakespeare
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "/\\/\\374|_"
metal
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "|\\/|3+41"
metal
metulburr@ubuntu:~/Downloads/leetspeak-master$ python3 leet.py "py7h0n 15 7h3 b357 pr06r4mm1n6 l4n6u463"
python is the best programming language
Actually *you* got it wrong, just try echo "p@$sw0rd" in your command prompt and guess what happened :)
do this command first, to fix it: sw0rd='''s$w0rd'''
or just use single quotes in a unix shell

it is not like python, and triple quotes only sorta work for the wrong reason (why did they work on the command given above?)