Morse decode by tabasa

import re\x0d
m={"=":" ",".-":"a","-...":"b","-.-.":"c","-..":"d",".":"e","..-.":"f","--.":"g","....":"h","..":"i",".---":"j","-.-":"k","...":"s","-":"t",".-..":"l","--":"m","-.":"n","---":"o",".--.":"p","--.-":"q",".-.":"r","..-":"u","...-":"v","-..-":"x",".--":"w","--..":"z","-.--":"y",".-.-.-":".","--..--":","}\x0d
w=raw_input()\x0d
w=re.sub(" ","/=/",w)\x0d
s=""\x0d
for i in w.split("/"):s+=m[i]\x0d
print s

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page