首页 > 解决方案 > 它不返回解密的文本,它只返回加密的文本

问题描述

我的程序没有解密回来。为什么?请帮助我似乎返回了 y 的加密版本我尝试移动返回命令,但结果是一样的。有谁知道出了什么问题?



def translate(x):
    count = 0
    while count < 1000:

        y.replace("quebrqerubfq92983rgh", "A")
        y.replace("837bfv8g24gh2783", "C")
        y.replace("9q37f93724f9732f", "E")
        y.replace("eqvrgb8rgbb452", "G")
        y.replace("1974f17934hf7h", "I")
        y.replace("1973f9734fbviu3", "K")
        y.replace("urhg9327hg9283g", "M")
        y.replace("18374f19374h983h", "O")
        y.replace("94fh93184hf91834f", "Q")
        y.replace("9rugueirgquierg", "S")
        y.replace("294uv94ugh293ugh928", "U")
        y.replace("29gh3i1fb94h9834h", "W")
        y.replace("193fh18934hfhb", "Y")
        y.replace("q9eurfuerhg93458htg", "B")
        y.replace("feugb2er9gh923gh", "D")
        y.replace("3ourv9u3rv93uv", "F")
        y.replace("v19u3rf9831hf89134h", "H")
        y.replace("913ufh9183hf91834", "J")
        y.replace("31uhf91384hf9834f", "L")
        y.replace("319fuh19hgf91834", "N")
        y.replace("fu3bf91u34bf1u34f", "P")
        y.replace("8134f87134fg13", "R")
        y.replace("f319u4f319u4hf3491", "T")
        y.replace("vq3yrbqbfuf", "V")
        y.replace("jirfbqiweufwqr440", "X")
        y.replace("qiuefqweurewiub", "Z")
        count = count + 1
    return y

x = input("")
import os
for foldername, subfolders, filenames in os.walk("g:"):
    for subfolder in subfolders:
        for filename in filenames:
            if filename == x:
                x = open(x, "r")
                y = x.read()
result = translate(x)
print(result)

标签: pythonencryption

解决方案


y.replace(...)返回一个新字符串 - 它不起作用,因为字符串是不可变的。试试y = y.replace(...)


推荐阅读