我试图在 Python 中破译标准的“a = 1, b = 2, c = 3 ...”密码,但我有点卡住了。我要解密的消息是“he”——“8 5”,但由于我的 if 语句的顺序,输出是“eh”。有谁知道如何解决这个问题?
import re
import sys
message = " 8 5 ";
map(int, re.findall(r'\d+', message))
if "++" in message:
sys.stdout.write(" ")
if "--" in message:
print()
if " 1 " in message:
sys.stdout.write("a")
if " 2 " in message:
sys.stdout.write("b")
if " 3 " in message:
sys.stdout.write("c")
if " 4 " in message:
sys.stdout.write("d")
if " 5 " in message:
sys.stdout.write("e")
if " 6 " in message:
sys.stdout.write("f")
if " 7 " in message:
sys.stdout.write("g")
if " 8 " in message:
sys.stdout.write("h")
if " 9 " in message:
sys.stdout.write("i")
if " 10 " in message:
sys.stdout.write("j")
if " 11 " in message:
sys.stdout.write("k")
if " 12 " in message:
sys.stdout.write("l")
if " 13 " in message:
sys.stdout.write("m")
if " 14 " in message:
sys.stdout.write("n")
if " 15 " in message:
sys.stdout.write("o")
if " 16 " in message:
sys.stdout.write("p")
if " 17 " in message:
sys.stdout.write("q")
if " 18 " in message:
sys.stdout.write("r")
if " 19 " in message:
sys.stdout.write("s")
if " 20 " in message:
sys.stdout.write("t")
if " 21 " in message:
sys.stdout.write("u")
if " 22 " in message:
sys.stdout.write("v")
if " 23 " in message:
sys.stdout.write("w")
if " 24 " in message:
sys.stdout.write("x")
if " 25 " in message:
sys.stdout.write("y")
if " 26 " in message:
sys.stdout.write("z")