本文整理匯總了Python中book.Book.to_tsv方法的典型用法代碼示例。如果您正苦於以下問題:Python Book.to_tsv方法的具體用法?Python Book.to_tsv怎麽用?Python Book.to_tsv使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類book.Book
的用法示例。
在下文中一共展示了Book.to_tsv方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: open
# 需要導入模塊: from book import Book [as 別名]
# 或者: from book.Book import to_tsv [as 別名]
series_page_html = r.read()
with open(series_page_file, 'w') as f:
f.write(series_page_html)
time.sleep(1)
# get links for every book in the series
book_links = parse_book_links(series.href, series_page_html)
logging.info('Found %d books' % len(book_links))
for book_link in book_links:
# get and download the book html_line_to_series
if book_link.title is None:
continue
logging.info('Examining book %s from %s' % (book_link.title, book_link.href))
book_file = 'data/html/%s_%s.html' % (clean_name(series.name), clean_name(book_link.title))
if os.path.exists(book_file):
logging.info('Reading book data from cached html file')
with open(book_file) as f:
book_html = f.read()
else:
logging.info('Reading book data from the web')
r = br.open(book_link.href)
book_html = r.read()
with open(book_file, 'w') as f:
f.write(book_html)
time.sleep(1)
book = Book(series.name, book_link.title, book_link.href, book_html)
with open(output_file, 'a') as f:
f.write(book.to_tsv())
f.write("\n")