From eddc1acc360a34bc22f78c73614d16a2b359b891 Mon Sep 17 00:00:00 2001 From: EdwardTL Date: Fri, 10 Jul 2020 14:25:55 -0500 Subject: [PATCH] Texto Decodificado --- src/main.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index 3f1ef43..e0d555f 100644 --- a/src/main.py +++ b/src/main.py @@ -1,9 +1,27 @@ # Resolve the problem!! - +import re +import os def run(): - # Start coding here + #Opening file + THIS_FOLDER = os.path.dirname(os.path.abspath(__file__)) + f = os.path.join(THIS_FOLDER, 'encoded.txt') + with open(f, 'rt', encoding='utf-8') as encoded_file: + content = encoded_file.read() + #RegEx Pattern + pattern = re.compile(r'[a-z]') + + #Extracting the marchs and storing as object + x = re.findall(pattern, content) + print(f'Object version: {x}') + + #Passinf to string + str_x = "" + for element in x: + str_x = str_x + element + print(f'String version: {str_x}') + encoded_file.close() if __name__ == '__main__': - run() + run() \ No newline at end of file