I am new to python and doing a test program that replaces all the letters in a given text with signs.
def encrypted(request):
text = request.GET['text']
text = text.replace("a", "#.")
text = text.replace("b", "##.")
text = text.replace("c", "###.")
text = text.replace("d", "####.")
text = text.replace("e", "#####.")
text = text.replace("f", "######.")
etc...
return render(request, 'encrypted.html', {'text': text})
I have achieved that but I have tried reversing it the same way and it does not work.
def decrypted(request):
ftext = request.GET['text']
ftext = ftext.replace("#.", "a")
ftext = ftext.replace("##.", "b")
ftext = ftext.replace("###.", "c")
ftext = ftext.replace("####.", "d")
ftext = ftext.replace("#####.", "e")
etc...
return render(request, 'decrypted.html')
So the text does not appear at all on the page.
<html lang="en">
<head>
<meta charset="UTF-8">
<title>yCrypt</title>
</head>
<body>
TEXT DECRYPTION: {{ftext}}
</body>
</html>
I wonder why it shows no code issues whatsoever. Maybe there is a simplier way to make this possible?