diff --git a/src/fb3_reader/fb3.py b/src/fb3_reader/fb3.py index 4c00326..f7f0087 100644 --- a/src/fb3_reader/fb3.py +++ b/src/fb3_reader/fb3.py @@ -1,12 +1,10 @@ -import sys from zipfile import ZipFile # from bs4 import BeautifulSoup # from lxml import etree -def reader(): - files = input("Enter the path to file: ") - with ZipFile(files) as book: - for row in book.read('2/fb3/body.xml').decode('utf-8').splitlines(): - opened = open("test.txt", "a") - opened.write(row) +def reader(path_to_file): + with ZipFile(path_to_file) as book: + for book_content in book.read('2/fb3/body.xml').decode('utf-8').splitlines(): + output_content = open("test.txt", "a") + output_content.write(book_content) diff --git a/src/fb3_reader/fb3.pyi b/src/fb3_reader/fb3.pyi new file mode 100644 index 0000000..c83594e --- /dev/null +++ b/src/fb3_reader/fb3.pyi @@ -0,0 +1 @@ +def reader(path_to_file: str): ... \ No newline at end of file diff --git a/src/main.py b/src/main.py index 223b06f..aef53ab 100644 --- a/src/main.py +++ b/src/main.py @@ -1,4 +1,4 @@ from fb3_reader import fb3 if __name__ == '__main__': - fb3.reader() + fb3.reader(input("Enter path to file: "))