Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from characterDict import char_dict
- def get_decrypted(_text):
- # get the count of words in the encrypted text
- wordsList = _text.replace("_"," ").strip().split(" ")
- decrypted_text = ""
- # loop through the words and decrypt them
- for word in wordsList:
- # strip the key from the encrypted word
- key = word[0] + word[-1]
- word = word[1:-1]
- # decrypt the word
- decrypted_word = ""
- lettersList = word.replace("|"," ").strip().split()
- for letter in lettersList:
- if letter != "":
- decrypted_word += "".join([k for k,v in char_dict.items() if str(v) == letter])
- decrypted_text += decrypted_word + " "
- return decrypted_text
- encrypted_text = "_1|70|5|12|12|15|3_2|16|25|20|8|15|14|6_3|16|18|15|7|18|1|13|13|5|18|19|9_5|47|27|28|29|30|31|32|33|34|91|2"
- print()
- print(get_decrypted(encrypted_text))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement