-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
32 lines (25 loc) · 853 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import argparse
from utilities import *
parser = argparse.ArgumentParser()
parser.add_argument("file_1", help="first text file")
parser.add_argument("file_2", help="second text file")
parser.add_argument(
"--html",
help="Saves the result in a table format inside an html file",
action="store_true",
)
args = parser.parse_args()
file_1, file_2 = args.file_1, args.file_2
with open(file_1, "r") as f1:
read_file1 = f1.read().split()
with open(file_2, "r") as f2:
read_file2 = f2.read().split()
if args.html:
path = save_to_Html(file_1, file_2, read_file1, read_file2)
print(f"Comparison table saved to {path}")
else:
counter, matched_words = print_to_console(read_file1, read_file2)
print(f"Total count of matched words : {counter}")
print(f"List of matched words: \n {matched_words}")
f1.close()
f2.close()