当前位置: 首页>>代码示例>>Python>>正文


Python Formatter.run_all方法代码示例

本文整理汇总了Python中formatter.Formatter.run_all方法的典型用法代码示例。如果您正苦于以下问题:Python Formatter.run_all方法的具体用法?Python Formatter.run_all怎么用?Python Formatter.run_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在formatter.Formatter的用法示例。


在下文中一共展示了Formatter.run_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_format_all

# 需要导入模块: from formatter import Formatter [as 别名]
# 或者: from formatter.Formatter import run_all [as 别名]
 def test_format_all(self):
   text = '''
   I HATE JUSTIN BIEBER comedy 
   I LOVE JUSTIN BIEBER comedy 
   JUSTIN BIEBER WEDDING comedy 
   JUSTIN BIEBER HAIR SOS 83 actress albino squirrel bored brittani taylor comedy entertainment fun funky funny happy hollywood hot justin bieber love missal random series sexy shout out sunday show silly sketch vampire vampires weekly 
   IS JUSTIN BIEBER CREEPY OR ADORABLE What Really Happened To Tiger Woods Criminal Names comedy newsinformation 
   Lady Gaga Alejandro Video Eats Rosary Miley Cyrus NO HOMO Spellbound Wins BGT comedy newsinformation 
   Black Eyed Peas on winning their 2nd consecutive AMA 2010 abc aguilera american awards bieber black bon christina clark dick diddy diddydirty dirty divorce dream enrique eyed iglesias jovi justin katy milian money music peas perry pink productions rihanna talkinterview tay the usher 
   '''
   formatter = Formatter(text, "\n")
   words = formatter.run_all()
   expect(words).to.equal(set(['hate justin bieber comedy', 'black eyed peas winning their consecutive aguilera american awards bieber black christina clark dick diddy diddydirty dirty divorce dream enrique eyed iglesias jovi justin katy milian money music peas perry pink productions rihanna talkinterview usher', 'justin bieber creepy adorable what really happened tiger woods criminal names comedy newsinformation', 'lady gaga alejandro video eats rosary miley cyrus homo spellbound wins comedy newsinformation', 'justin bieber hair actress albino squirrel bored brittani taylor comedy entertainment funky funny happy hollywood justin bieber love missal random series sexy shout sunday show silly sketch vampire vampires weekly', 'love justin bieber comedy', 'justin bieber wedding comedy']))
开发者ID:UMNLibraries,项目名称:hamster,代码行数:15,代码来源:test_formatter.py


注:本文中的formatter.Formatter.run_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。