统一格式(无实质改动) & 添加了图片 (#23)

* 修复了style和script标签无法去除的问题

* 添加了图片展示 & 统一了引号格式

* 添加了图片展示 & 统一了引号格式

* 统一引号格式并异步处理函数
This commit is contained in:
Nya_Twisuki
2024-12-12 13:47:28 +08:00
committed by GitHub
parent 6a4b0bbd0d
commit b939a48b0b
6 changed files with 74 additions and 65 deletions

View File

@@ -1,37 +1,37 @@
# MorseCode
MorseEncode = {
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.',
'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-',
'Y': '-.--', 'Z': '--..',
'1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....',
'6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----',
'.': '.-.-.-', ':': '---...', ',': '--..--', ';': '-.-.-.',
'?': '..--..', '=': '-...-', '\'': '.----.', '/': '-..-.',
'!': '-.-.--', '-': '-....-', '_': '..--.-', '\"': '.-..-.',
'(': '-.--.', ')': '-.--.-', '$': '...-..-', '&': '....',
'@': '.--.-.', ' ': ' '
"A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.",
"G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..",
"M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.",
"S": "...", "T": "-", "U": "..-", "V": "...-", "W": ".--", "X": "-..-",
"Y": "-.--", "Z": "--..",
"1": ".----", "2": "..---", "3": "...--", "4": "....-", "5": ".....",
"6": "-....", "7": "--...", "8": "---..", "9": "----.", "0": "-----",
".": ".-.-.-", ":": "---...", ",": "--..--", ";": "-.-.-.",
"?": "..--..", "=": "-...-", "\'": ".----.", "/": "-..-.",
"!": "-.-.--", "-": "-....-", "_": "..--.-", "\"": ".-..-.",
"(": "-.--.", ")": "-.--.-", "$": "...-..-", "&": "....",
"@": ".--.-.", " ": " "
}
MorseDecode = {value: key for key, value in MorseEncode.items()}
# MorseCode Encrypt
def morse_encrypt(msg: str):
async def morse_encrypt(msg: str):
result = ""
msg = msg.upper()
for char in msg:
if char in MorseEncode:
result += MorseEncode[char]
else:
result += '..--..'
result += ' '
result += "..--.."
result += " "
return result
# MorseCode Decrypt
def morse_decrypt(msg: str):
async def morse_decrypt(msg: str):
result = ""
msg_arr = msg.split()
@@ -39,6 +39,6 @@ def morse_decrypt(msg: str):
if char in MorseDecode:
result += MorseDecode[char]
else:
result += '?'
result += "?"
return result