本文整理汇总了Python中pyparsing.ZeroOrMore.runTests方法的典型用法代码示例。如果您正苦于以下问题:Python ZeroOrMore.runTests方法的具体用法?Python ZeroOrMore.runTests怎么用?Python ZeroOrMore.runTests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyparsing.ZeroOrMore
的用法示例。
在下文中一共展示了ZeroOrMore.runTests方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Word
# 需要导入模块: from pyparsing import ZeroOrMore [as 别名]
# 或者: from pyparsing.ZeroOrMore import runTests [as 别名]
#
# A simple example showing the use of the implied listAllMatches=True for
# results names with a trailing '*' character.
#
# This example performs work similar to itertools.groupby, but without
# having to sort the input first.
#
# Copyright 2004-2016, by Paul McGuire
#
from pyparsing import Word, ZeroOrMore, nums
aExpr = Word("A", nums)
bExpr = Word("B", nums)
cExpr = Word("C", nums)
grammar = ZeroOrMore(aExpr("A*") | bExpr("B*") | cExpr("C*"))
grammar.runTests("A1 B1 A2 C1 B2 A3")