python类stringStart()的实例源码

strutils.py 文件源码 项目:deb-oslo.utils 作者: openstack 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号