diff --git a/cast.html b/cast.html index 5c18cc3..75b6ede 100644 --- a/cast.html +++ b/cast.html @@ -2,6 +2,7 @@ My Readings + diff --git a/main.py b/main.py index f6fff43..ec3e886 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,8 @@ import json +import sys from Book import Book + # Opening JSON file f = open('constructor.json', encoding='utf-8') data = json.load(f) @@ -17,5 +19,12 @@ for book_data in books: html += book.to_html() f = open("cast.html") -print(f.read().replace("{{books}}", html).replace("{{style}}", style)) -f.close() \ No newline at end of file +text = f.read().replace("{{books}}", html).replace("{{style}}", style) +f.close() + +if len(sys.argv) > 1: + f = open(sys.argv[1], "w", encoding='utf-8') + f.write(text) + f.close() +else: + print(text) \ No newline at end of file