{ "cells": [ { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n" ] } ], "source": [ "from library import Catalogue\n", "import zipfile\n", "import pprint as pp\n", "import re\n", "\n", "Catalogue = Catalogue()\n", "book_list = Catalogue.filter_books(1)\n", "unpacked = []\n", "\n", "for book in book_list:\n", " book = zipfile.ZipFile(book, 'r')\n", " with book as bookzip:\n", " try:\n", " content_opf = bookzip.open('content.opf')\n", " print(content_opf)\n", " except KeyError as e:\n", " expanded = bookzip.infolist()\n", " regx1 = re.compile(r'\\.opf|^cover')\n", " for i in expanded:\n", " if re.search(regx1, str(i)) == True: pp.pprint(i.filename); print(res)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" } }, "nbformat": 4, "nbformat_minor": 4 }