From 6f48d434b96521e0e999aca8dd7bbdf3bb5ae5c4 Mon Sep 17 00:00:00 2001 From: Dishant Rathi Date: Sun, 27 May 2018 12:10:40 +0530 Subject: [PATCH] Update ex23.py EX:23 - Code was missing. Ref. : LP3THW --- ex23.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ex23.py b/ex23.py index 9e42102..1f338cd 100644 --- a/ex23.py +++ b/ex23.py @@ -1 +1,19 @@ -# empty exercise +import sys +script , input_encoding , error = sys.argv + +def main(language_file, encoding, errors): + line = language_file.readline() + if line: + print_line(line, encoding, errors) + return main(language_file,encoding,errors) + +def print_line(line, encoding, errors): + next_lang = line.strip() + rawbytes = next_lang.encode(encoding, errors=errors) + coostr = rawbytes.decode(encoding, errors=errors) + + print(rawbytes, ":===:" ,coostr) + +languages = open("languages.txt",encoding="utf-8") + +main(languages ,input_encoding ,error)