Python pyparsing 模块,stringStart() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用pyparsing.stringStart()

项目:deb-oslo.utils    作者:openstack    | 项目源码 | 文件源码
def split_by_commas(value):
    """Split values by commas and quotes according to api-wg

    :param value: value to be split

    .. versionadded:: 3.17
    """
    word = (pp.QuotedString(quoteChar='"', escChar='\\')
            | pp.Word(pp.printables, excludeChars='",'))
    grammar = pp.stringStart + pp.delimitedList(word) + pp.stringEnd

    try:
        return list(grammar.parseString(value))
    except pp.ParseException:
        raise ValueError("Invalid value: %s" % value)