fb3test/src/fb3_reader/fb3.py

9 lines
280 B
Python

from zipfile import ZipFile
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)