from epub_conversion.utils import open_book, convert_epub_to_lines
f = open("demofile.txt", "a")
book = open_book("razvansividra.epub")
lines = convert_epub_to_lines(book)
EbookLib is a Python library for managing EPUB2/EPUB3 and Kindle
files. It's capable of reading and writing EPUB files programmatically
(Kindle support is under development).
The API is designed to be as simple as possible, while at the same
time making complex things possible too. It has support for covers,
table of contents, spine, guide, metadata and etc.
import ebooklib
from ebooklib import epub
book = epub.read_epub('test.epub')
for doc in book.get_items_of_type(ebooklib.ITEM_DOCUMENT):
print doc
关于https://github.com/aerkalov/ebooklib
convert_epub_to_lines返回迭代器to lines,需要逐个迭代才能得到。在
相反,您可以使用“convert”获取所有行,请参见库文档中的:
https://pypi.org/project/epub-conversion/
相关问题 更多 >
编程相关推荐