-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex23.py
More file actions
23 lines (18 loc) · 705 Bytes
/
ex23.py
File metadata and controls
23 lines (18 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
script, read_file, 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[:8] + line[8:]
# raw_bytes = line.encode(encoding, errors=errors)
cooked_string = next_lang.decode(encoding, errors=errors)
# byte_file.write(raw_bytes)
print(line, "<===>", cooked_string)
# print(next_lang)
languages = open(read_file, encoding="utf-8")
# languages = open(read_file, "rb")
byte_file = open("raw_bytes.txt", "rb")
main(byte_file, input_encoding, error)