diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-04-10 17:57:04 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-04-10 17:57:04 +0800 |
| commit | 467b21111e45f4e47d43c9e228256a85ad0c2899 (patch) | |
| tree | c184bb10096e818b9190194948ffbf17ce7bd8aa | |
| parent | 402bb161a3caf2d6511bbd7c47ed63d22a907840 (diff) | |
optimized what happens if its not in the dictionary
| -rw-r--r-- | __pycache__/stdlib.cpython-312.pyc | bin | 11037 -> 11037 bytes | |||
| -rw-r--r-- | main.py | 17 |
2 files changed, 10 insertions, 7 deletions
diff --git a/__pycache__/stdlib.cpython-312.pyc b/__pycache__/stdlib.cpython-312.pyc Binary files differindex 74732eb..e12a634 100644 --- a/__pycache__/stdlib.cpython-312.pyc +++ b/__pycache__/stdlib.cpython-312.pyc @@ -116,9 +116,6 @@ def main(): transmode = 1 reverseMode(in_data) -def outputter(data): - aprintf(data) - def normalMode(data: str): """ @@ -135,8 +132,11 @@ def normalMode(data: str): global in_data, out_data aprintf("Mode selected: Normal Mode") for i in data: - out_data += list(map.keys())[list(map.values()).index(i)] - outputter(out_data) + try: + tmp = list(map.keys())[list(map.values()).index(i)] + except ValueError: + tmp = i + printf(tmp) @@ -145,8 +145,11 @@ def reverseMode(data: str): global in_data, out_data aprintf("Mode selected: Reverse Mode") for i in data: - out_data += map[i] - outputter(out_data) + try: + tmp = map[i] + except KeyError: + tmp = i + printf(tmp) if __name__ == '__main__': in_data = keepasks("What is the data you want to transfer?", inputter=askinput) |
