本文整理汇总了Python中src.tools.match.Match.replace_words方法的典型用法代码示例。如果您正苦于以下问题:Python Match.replace_words方法的具体用法?Python Match.replace_words怎么用?Python Match.replace_words使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.tools.match.Match
的用法示例。
在下文中一共展示了Match.replace_words方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_info
# 需要导入模块: from src.tools.match import Match [as 别名]
# 或者: from src.tools.match.Match import replace_words [as 别名]
def set_info(self, info):
self.info.update(info)
if self.kind == Type.csdnblog_author:
self.epub.title = u'csdn博客作者_{}({})文章集锦'.format(info['creator_name'], info['creator_id'])
self.epub.id = info['creator_id']
elif self.kind == Type.cnblogs_author:
self.epub.title = u'cnblogs作者_{}({})文章集锦'.format(info['creator_name'], info['creator_id'])
self.epub.id = info['creator_id']
elif self.kind == Type.jianshu_author: # 该博客所有的博文
self.epub.title = u'简书作者_{}({})文章集锦'.format(info['creator_name'], info['creator_id'])
self.epub.id = info['creator_id']
elif self.kind == Type.jianshu_collection:
self.epub.title = u'简书专题_{}({})'.format(info['title'], info['collection_fake_id'])
self.epub.id = info['collection_fake_id']
elif self.kind == Type.jianshu_notebooks:
self.epub.title = u'简书文集_{}({})'.format(info['title'], info['notebooks_id'])
self.epub.id = info['notebooks_id']
elif self.kind == Type.jianshu_article: # 单篇博文 TODO
self.epub.title = u'简书博文集锦({})'.format(info['title'])
self.epub.id = info['id'] # TODO
elif self.kind == Type.sinablog_author: # 该博客所有的博文
self.epub.title = u'新浪博客_{}({})'.format(info['creator_name'], info['creator_id'])
self.epub.id = info['creator_id']
elif self.kind == Type.sinablog_article: # 新浪单篇博文 TODO
self.epub.title = u'新浪博客博文集锦({})'.format(info['title'])
self.epub.id = info['id'] # TODO
elif self.kind == Type.question:
self.epub.title = u'知乎问题集锦({})'.format(info['title'])
self.epub.id = info['id']
elif self.kind == Type.answer:
self.epub.title = u'知乎回答集锦({})'.format(info['title'])
self.epub.id = info['id']
elif self.kind == Type.article:
self.epub.title = u'知乎专栏文章集锦({})'.format(info['title'])
self.epub.id = info['id']
elif self.kind == Type.topic:
self.epub.title = u'知乎话题_{}({})'.format(info['title'], info['topic_id'])
self.epub.id = info['topic_id']
elif self.kind == Type.collection:
self.epub.title = u'知乎收藏夹_{}({})'.format(info['title'], info['collection_id'])
self.epub.id = info['collection_id']
elif self.kind == Type.author:
self.epub.title = u'知乎作者_{}({})'.format(info['name'], info['author_id'])
self.epub.id = info['author_id']
elif self.kind == Type.column:
self.epub.title = u'知乎专栏_{}({})'.format(info['name'], info['column_id'])
self.epub.id = info['column_id']
elif self.kind == Type.yiibai:
self.epub.title = u'易百教程_{}'.format(info['title'])
self.epub.id = info['creator_id']
elif self.kind == Type.talkpython:
self.epub.title = u'TalkPythonToMe'
self.epub.id = info['creator_id']
from src.html5lib.constants import entities_reverse
self.epub.title = Match.replace_words(self.epub.title, entities_reverse)
return